Show More
@@ -42,6 +42,8 b' class PylabMagics(Magics):' | |||||
42 | @skip_doctest |
|
42 | @skip_doctest | |
43 | @line_magic |
|
43 | @line_magic | |
44 | @magic_arguments.magic_arguments() |
|
44 | @magic_arguments.magic_arguments() | |
|
45 | @magic_arguments.argument('-l', '--list', action='store_true', | |||
|
46 | help='Show available matplotlib backends') | |||
45 | @magic_gui_arg |
|
47 | @magic_gui_arg | |
46 | def matplotlib(self, line=''): |
|
48 | def matplotlib(self, line=''): | |
47 | """Set up matplotlib to work interactively. |
|
49 | """Set up matplotlib to work interactively. | |
@@ -83,10 +85,20 b' class PylabMagics(Magics):' | |||||
83 | But you can explicitly request a different GUI backend:: |
|
85 | But you can explicitly request a different GUI backend:: | |
84 |
|
86 | |||
85 | In [3]: %matplotlib qt |
|
87 | In [3]: %matplotlib qt | |
|
88 | ||||
|
89 | You can list the available backends using the -l/--list option | |||
|
90 | ||||
|
91 | In [4]: %matplotlib --list | |||
|
92 | Available matplotlib backends: ['osx', 'qt4', 'qt5', 'gtk3', 'notebook', 'wx', 'qt', 'nbagg', | |||
|
93 | 'gtk', 'tk', 'inline'] | |||
86 | """ |
|
94 | """ | |
87 | args = magic_arguments.parse_argstring(self.matplotlib, line) |
|
95 | args = magic_arguments.parse_argstring(self.matplotlib, line) | |
88 | gui, backend = self.shell.enable_matplotlib(args.gui) |
|
96 | if args.list: | |
89 | self._show_matplotlib_backend(args.gui, backend) |
|
97 | backends_list = list(backends.keys()) | |
|
98 | print("Available matplotlib backends: %s" % backends_list) | |||
|
99 | else: | |||
|
100 | gui, backend = self.shell.enable_matplotlib(args.gui) | |||
|
101 | self._show_matplotlib_backend(args.gui, backend) | |||
90 |
|
102 | |||
91 | @skip_doctest |
|
103 | @skip_doctest | |
92 | @line_magic |
|
104 | @line_magic |
General Comments 0
You need to be logged in to leave comments.
Login now