Skip to content

Commit 58bd19b

Browse files
committed
Some explanatory comments.
1 parent 86f6cb3 commit 58bd19b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/pyplot.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ def switch_backend(newbackend):
224224
rcParamsOrig["backend"] = "agg"
225225
return
226226

227+
# Backends are implemented as modules, but "inherit" default method
228+
# implementations from backend_bases._Backend. This is achieved by
229+
# creating a "class" that inherits from backend_bases._Backend and whose
230+
# body is filled with the module's globals.
231+
227232
backend_name = cbook._backend_module_name(newbackend)
228233

229234
class _backend_mod(matplotlib.backend_bases._Backend):
@@ -261,18 +266,21 @@ def _warn_if_gui_out_of_main_thread():
261266
"fail.")
262267

263268

269+
# This function's signature is rewritten upon backend-load by switch_backend.
264270
def new_figure_manager(*args, **kwargs):
265271
"""Create a new figure manager instance."""
266272
global _backend_mod
267273
_warn_if_gui_out_of_main_thread()
268274
return _backend_mod.new_figure_manager(*args, **kwargs)
269275

270276

277+
# This function's signature is rewritten upon backend-load by switch_backend.
271278
def draw_if_interactive(*args, **kwargs):
272279
global _backend_mod
273280
return _backend_mod.draw_if_interactive(*args, **kwargs)
274281

275282

283+
# This function's signature is rewritten upon backend-load by switch_backend.
276284
def show(*args, **kwargs):
277285
"""
278286
Display all figures.

0 commit comments

Comments
 (0)