Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 31b1b91

Browse filesBrowse files
authored
Merge pull request #29172 from anntzer/clean
Minor cleanups to docstrings, comments, and error messages.
2 parents b1d2ecd + 447ea3d commit 31b1b91
Copy full SHA for 31b1b91

File tree

Expand file treeCollapse file tree

4 files changed

+18
-22
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+18
-22
lines changed

‎galleries/examples/text_labels_and_annotations/dfrac_demo.py

Copy file name to clipboardExpand all lines: galleries/examples/text_labels_and_annotations/dfrac_demo.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
66
In this example, the differences between the \\dfrac and \\frac TeX macros are
77
illustrated; in particular, the difference between display style and text style
8-
fractions when using Mathtex.
8+
fractions when using Mathtext.
99
1010
.. versionadded:: 2.1
1111
1212
.. note::
1313
To use \\dfrac with the LaTeX engine (text.usetex : True), you need to
14-
import the amsmath package with the text.latex.preamble rc, which is
14+
import the amsmath package with :rc:`text.latex.preamble`, which is
1515
an unsupported feature; therefore, it is probably a better idea to just
1616
use the \\displaystyle option before the \\frac macro to get this behavior
1717
with the LaTeX engine.

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,7 @@ def xkcd(
818818
819819
Notes
820820
-----
821-
This function works by a number of rcParams, so it will probably
822-
override others you have set before.
821+
This function works by a number of rcParams, overriding those set before.
823822
824823
If you want the effects of this function to be temporary, it can
825824
be used as a context manager, for example::
@@ -1192,9 +1191,7 @@ def close(fig: None | int | str | Figure | Literal["all"] = None) -> None:
11921191
_pylab_helpers.Gcf.destroy_all()
11931192
elif isinstance(fig, int):
11941193
_pylab_helpers.Gcf.destroy(fig)
1195-
elif hasattr(fig, 'int'):
1196-
# if we are dealing with a type UUID, we
1197-
# can use its integer representation
1194+
elif hasattr(fig, 'int'): # UUIDs get converted to ints by figure().
11981195
_pylab_helpers.Gcf.destroy(fig.int)
11991196
elif isinstance(fig, str):
12001197
all_labels = get_figlabels()
@@ -1204,8 +1201,8 @@ def close(fig: None | int | str | Figure | Literal["all"] = None) -> None:
12041201
elif isinstance(fig, Figure):
12051202
_pylab_helpers.Gcf.destroy_fig(fig)
12061203
else:
1207-
raise TypeError("close() argument must be a Figure, an int, a string, "
1208-
"or None, not %s" % type(fig))
1204+
_api.check_isinstance( # type: ignore[unreachable]
1205+
(Figure, int, str, None), fig=fig)
12091206

12101207

12111208
def clf() -> None:

‎lib/matplotlib/tests/test_pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pyplot.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ def test_close():
163163
try:
164164
plt.close(1.1)
165165
except TypeError as e:
166-
assert str(e) == "close() argument must be a Figure, an int, " \
167-
"a string, or None, not <class 'float'>"
166+
assert str(e) == (
167+
"'fig' must be an instance of matplotlib.figure.Figure, int, str "
168+
"or None, not a float")
168169

169170

170171
def test_subplot_reuse():

‎lib/matplotlib/ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/ticker.py
+9-11Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,7 @@ class IndexLocator(Locator):
17411741
IndexLocator assumes index plotting; i.e., that the ticks are placed at integer
17421742
values in the range between 0 and len(data) inclusive.
17431743
"""
1744+
17441745
def __init__(self, base, offset):
17451746
"""Place ticks every *base* data point, starting at *offset*."""
17461747
self._base = base
@@ -1793,9 +1794,7 @@ def tick_values(self, vmin, vmax):
17931794
17941795
.. note::
17951796
1796-
Because the values are fixed, vmin and vmax are not used in this
1797-
method.
1798-
1797+
Because the values are fixed, *vmin* and *vmax* are not used.
17991798
"""
18001799
if self.nbins is None:
18011800
return self.locs
@@ -1810,7 +1809,7 @@ def tick_values(self, vmin, vmax):
18101809

18111810
class NullLocator(Locator):
18121811
"""
1813-
No ticks
1812+
Place no ticks.
18141813
"""
18151814

18161815
def __call__(self):
@@ -1822,8 +1821,7 @@ def tick_values(self, vmin, vmax):
18221821
18231822
.. note::
18241823
1825-
Because the values are Null, vmin and vmax are not used in this
1826-
method.
1824+
Because there are no ticks, *vmin* and *vmax* are not used.
18271825
"""
18281826
return []
18291827

@@ -1832,12 +1830,11 @@ class LinearLocator(Locator):
18321830
"""
18331831
Place ticks at evenly spaced values.
18341832
1835-
The first time this function is called it will try to set the
1836-
number of ticks to make a nice tick partitioning. Thereafter, the
1837-
number of ticks will be fixed so that interactive navigation will
1838-
be nice
1839-
1833+
The first time this function is called, it will try to set the number of
1834+
ticks to make a nice tick partitioning. Thereafter, the number of ticks
1835+
will be fixed to avoid jumping during interactive navigation.
18401836
"""
1837+
18411838
def __init__(self, numticks=None, presets=None):
18421839
"""
18431840
Parameters
@@ -1997,6 +1994,7 @@ class _Edge_integer:
19971994
Take floating-point precision limitations into account when calculating
19981995
tick locations as integer multiples of a step.
19991996
"""
1997+
20001998
def __init__(self, step, offset):
20011999
"""
20022000
Parameters

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.