Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e54e44b

Browse files
committed
Simpler if statement and added line to the docs
1 parent 5d4f256 commit e54e44b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

IPython/core/magics/pylab.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PylabMagics(Magics):
4242
@skip_doctest
4343
@line_magic
4444
@magic_arguments.magic_arguments()
45-
@magic_arguments.argument('-l', '--list', default=None, action='store_true',
45+
@magic_arguments.argument('-l', '--list', default=False, action='store_true',
4646
help='Show available matplotlib backends')
4747
@magic_gui_arg
4848
def matplotlib(self, line=''):
@@ -85,11 +85,15 @@ def matplotlib(self, line=''):
8585
But you can explicitly request a different GUI backend::
8686
8787
In [3]: %matplotlib qt
88-
"""
8988
90-
args = magic_arguments.parse_argstring(self.matplotlib, line)
89+
You can list the available backends using the -l/--list option
9190
92-
if args.list is not None:
91+
In [4]: %matplotlib --list
92+
Available matplotlib backends: ['osx', 'qt4', 'qt5', 'gtk3', 'notebook', 'wx', 'qt', 'nbagg',
93+
'gtk', 'tk', 'inline']
94+
"""
95+
args = magic_arguments.parse_argstring(self.matplotlib, line)
96+
if args.list:
9397
backends_list = list(backends.keys())
9498
print("Available matplotlib backends: %s" % backends_list)
9599
else:

0 commit comments

Comments
 (0)