Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit9acea51

Browse files
committed
simplify docstrings
1 parentca844fd commit9acea51

File tree

2 files changed

+17
-45
lines changed

2 files changed

+17
-45
lines changed

‎lib/matplotlib/axis.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,19 +1549,7 @@ def set_minor_formatter(self, formatter):
15491549
15501550
In addition to a `~matplotlib.ticker.Formatter` instance,
15511551
this also accepts a ``str`` or function.
1552-
1553-
For a ``str`` a `~matplotlib.ticker.StrMethodFormatter` is used.
1554-
The field used for the value must be labeled ``'x'`` and the field used
1555-
for the position must be labeled ``'pos'``.
1556-
See the `~matplotlib.ticker.StrMethodFormatter` documentation for
1557-
more information.
1558-
1559-
For a function a `~matplotlib.ticker.FuncFormatter` is used.
1560-
The function should take in two inputs (a tick value ``x`` and a
1561-
position ``pos``), and return a string containing the corresponding
1562-
tick label.
1563-
See the `~matplotlib.ticker.FuncFormatter` documentation for
1564-
more information.
1552+
See `.Axis.set_major_formatter` for more information.
15651553
15661554
Parameters
15671555
----------
@@ -1570,30 +1558,6 @@ def set_minor_formatter(self, formatter):
15701558
self._set_formatter(formatter,self.minor)
15711559

15721560
def_set_formatter(self,formatter,level):
1573-
"""
1574-
Set the formatter of the major or minor ticker.
1575-
1576-
In addition to a `~matplotlib.ticker.Formatter` instance,
1577-
this also accepts a ``str`` or function.
1578-
1579-
For a ``str`` a `~matplotlib.ticker.StrMethodFormatter` is used.
1580-
The field used for the value must be labeled ``'x'`` and the field used
1581-
for the position must be labeled ``'pos'``.
1582-
See the `~matplotlib.ticker.StrMethodFormatter` documentation for
1583-
more information.
1584-
1585-
For a function a `~matplotlib.ticker.FuncFormatter` is used.
1586-
The function should take in two inputs (a tick value ``x`` and a
1587-
position ``pos``), and return a string containing the corresponding
1588-
tick label.
1589-
See the `~matplotlib.ticker.FuncFormatter` documentation for
1590-
more information.
1591-
1592-
Parameters
1593-
----------
1594-
formatter : `~matplotlib.ticker.Formatter`, ``str``, or function
1595-
level : `self.major` or `self.minor`
1596-
"""
15971561
ifisinstance(formatter,str):
15981562
formatter=mticker.StrMethodFormatter(formatter)
15991563
# Don't allow any other TickHelper to avoid easy-to-make errors,

‎lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,17 @@ def _formfunc(x, pos):
210210

211211
ax=plt.figure().subplots()
212212

213-
assertax.xaxis.isDefault_majfmt==True
214-
assertax.xaxis.isDefault_minfmt==True
213+
assertax.xaxis.isDefault_majfmt
214+
assertax.xaxis.isDefault_minfmt
215+
assertax.yaxis.isDefault_majfmt
216+
assertax.yaxis.isDefault_minfmt
215217

216218
ax.xaxis.set_major_formatter(_formfunc)
217219

218-
assertax.xaxis.isDefault_majfmt==False
219-
assertax.xaxis.isDefault_minfmt==True
220+
assertnotax.xaxis.isDefault_majfmt
221+
assertax.xaxis.isDefault_minfmt
222+
assertax.yaxis.isDefault_majfmt
223+
assertax.yaxis.isDefault_minfmt
220224

221225
targ_funcformatter=mticker.FuncFormatter(_formfunc)
222226

@@ -231,13 +235,17 @@ def test_strmethodformatter_auto_formatter():
231235

232236
ax=plt.figure().subplots()
233237

234-
assertax.yaxis.isDefault_majfmt==True
235-
assertax.yaxis.isDefault_minfmt==True
238+
assertax.xaxis.isDefault_majfmt
239+
assertax.xaxis.isDefault_minfmt
240+
assertax.yaxis.isDefault_majfmt
241+
assertax.yaxis.isDefault_minfmt
236242

237243
ax.yaxis.set_minor_formatter(formstr)
238244

239-
assertax.yaxis.isDefault_majfmt==True
240-
assertax.yaxis.isDefault_minfmt==False
245+
assertax.xaxis.isDefault_majfmt
246+
assertax.xaxis.isDefault_minfmt
247+
assertax.yaxis.isDefault_majfmt
248+
assertnotax.yaxis.isDefault_minfmt
241249

242250
targ_strformatter=mticker.StrMethodFormatter(formstr)
243251

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp