From be76a29c65b899256ebe3c43f9c5cd5a0e768790 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 5 May 2019 18:20:35 +0200 Subject: [PATCH] Backport PR #14109: Some simple pyplot doc improvements --- lib/matplotlib/pyplot.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index f23013e95ca9..dcf13ec7d92f 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -245,6 +245,7 @@ def switch_backend(newbackend): def show(*args, **kw): """ Display a figure. + When running in ipython with its pylab mode, display all figures and return to the ipython prompt. @@ -338,6 +339,11 @@ def gci(): :class:`~matplotlib.collections.Collection` instances. The current image is an attribute of the current axes, or the nearest earlier axes in the current figure that contains an image. + + Notes + ----- + Historically, the only colorable artists were images; hence the name + ``gci`` (get current image). """ return gcf()._gci() @@ -426,7 +432,6 @@ def figure(num=None, # autoincrement if None, else integer from 1-N Parameters ---------- - num : integer or string, optional, default: None If not provided, a new figure will be created, and the figure number will be incremented. The figure objects holds this number in a `number` @@ -579,7 +584,12 @@ def _auto_draw_if_interactive(fig, val): def gcf(): - """Get a reference to the current figure.""" + """ + Get the current figure. + + If no current figure exists, a new one is created using + `~.pyplot.figure()`. + """ figManager = _pylab_helpers.Gcf.get_active() if figManager is not None: return figManager.canvas.figure @@ -606,9 +616,17 @@ def get_figlabels(): def get_current_fig_manager(): """ - Return the figure manager of the active figure. + Return the figure manager of the current figure. + + The figure manager is a container for the actual backend-depended window + that displays the figure on screen. - If there is currently no active figure, a new one is created. + If if no current figure exists, a new one is created an its figure + manager is returned. + + Returns + ------- + manager : `.FigureManagerBase` or backend-dependent subclass thereof """ figManager = _pylab_helpers.Gcf.get_active() if figManager is None: