diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 147500dd5451..580a8e7df59d 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -979,9 +979,12 @@ def clf(self, keep_observers=False): """ return self.clear(keep_observers=keep_observers) - # Note: in the docstring below, the newlines in the examples after the - # calls to legend() allow replacing it with figlegend() to generate the - # docstring of pyplot.figlegend. + # Note: the docstring below is modified with replace for the pyplot + # version of this function because the method name differs (plt.figlegend) + # the replacements are: + # " legend(" -> " figlegend(" for the signatures + # "fig.legend(" -> "plt.figlegend" for the code examples + # "ax.plot" -> "plt.plot" for consistency in using pyplot when able @_docstring.dedent_interpd def legend(self, *args, **kwargs): """ diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 4777327bfe99..885fccb16eec 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -980,7 +980,10 @@ def savefig(*args, **kwargs): def figlegend(*args, **kwargs): return gcf().legend(*args, **kwargs) if Figure.legend.__doc__: - figlegend.__doc__ = Figure.legend.__doc__.replace("legend(", "figlegend(") + figlegend.__doc__ = Figure.legend.__doc__ \ + .replace(" legend(", " figlegend(") \ + .replace("fig.legend(", "plt.figlegend(") \ + .replace("ax.plot(", "plt.plot(") ## Axes ##
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: