Skip to content

Commit e460321

Browse files
committed
Some explanatory comments.
1 parent 06d6c36 commit e460321

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/pyplot.py

+8
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ def switch_backend(newbackend):
221221
rcParamsOrig["backend"] = "agg"
222222
return
223223

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

226231
class backend_mod(matplotlib.backend_bases._Backend):
@@ -258,18 +263,21 @@ def _warn_if_gui_out_of_main_thread():
258263
"fail.")
259264

260265

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

267273

274+
# This function's signature is rewritten upon backend-load by switch_backend.
268275
def draw_if_interactive(*args, **kwargs):
269276
global _backend_mod
270277
return _backend_mod.draw_if_interactive(*args, **kwargs)
271278

272279

280+
# This function's signature is rewritten upon backend-load by switch_backend.
273281
def show(*args, **kwargs):
274282
"""
275283
Display all figures.

0 commit comments

Comments
 (0)