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

Skip to content

Commit 35b80cc

Browse files
committed
MNT/DOC: add input to pylab_setup + docs
- add backend as an input (maybe useful?) - add numpydoc style docstring
1 parent b0db83e commit 35b80cc

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

lib/matplotlib/backends/__init__.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,36 @@
88
import warnings
99

1010

11-
def pylab_setup():
12-
'return new_figure_manager, draw_if_interactive and show for pylab'
11+
def pylab_setup(backend=None):
12+
'''return new_figure_manager, draw_if_interactive and show for pyplot
13+
14+
This provides the backend-specific functions that are used by
15+
pyplot to abstract away the difference between interactive backends.
16+
17+
Parameters
18+
----------
19+
backend : str, optional
20+
The name of the backend to use. If `None`, falls back to
21+
``matplotlib.get_backend()`` (which return ``rcParams['backend']``)
22+
23+
Returns
24+
-------
25+
backend_mod : module
26+
The module which contains the backend of choice
27+
28+
new_figure_manager : function
29+
Create a new figure manage (roughly maps to GUI window)
30+
31+
draw_if_interactive : function
32+
Redraw the current figure if pyplot is interactive
33+
34+
show : function
35+
Show (and possible block) any unshown figures.
36+
37+
'''
1338
# Import the requested backend into a generic module object
14-
backend = matplotlib.get_backend() # validates, to match all_backends
39+
if backend is None:
40+
backend = matplotlib.get_backend() # validates, to match all_backends
1541

1642
if backend.startswith('module://'):
1743
backend_name = backend[9:]

0 commit comments

Comments
 (0)