FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix pyplot.figlegend docstring by ksunden · Pull Request #24434 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 6 additions & 3 deletions lib/matplotlib/figure.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
5 changes: 4 additions & 1 deletion lib/matplotlib/pyplot.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##
Expand Down

Back | FazBrowse Home | New Git URL