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

Commitbc18ac4

Browse files
committed
Fix broken references.
In particular, the property table for artists was changed to point linksto the parent method which actually provides the docstring, if thedocstring is inherited.
1 parent3d9fde4 commitbc18ac4

File tree

6 files changed

+43
-51
lines changed

6 files changed

+43
-51
lines changed

‎doc/api/axis_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Interactive
146146
:template: autosummary.rst
147147
:nosignatures:
148148

149-
149+
Axis.contains
150150
Axis.get_pickradius
151151
Axis.set_pickradius
152152

‎doc/users/prev_whats_new/whats_new_1.5.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ which allow artist-level control of LaTeX rendering vs. the internal mathtex
509509
rendering.
510510

511511

512-
`.Axes.remove()` works as expected
513-
``````````````````````````````````
512+
``Axes.remove()`` works as expected
513+
```````````````````````````````````
514514

515515
As with artists added to an:class:`~matplotlib.axes.Axes`,
516516
`~.axes.Axes` objects can be removed from their figure via
517-
:meth:`~matplotlib.axes.Axes.remove()`.
517+
`~.Artist.remove()`.
518518

519519

520520
API Consistency fix within Locators set_params() function

‎examples/pyplots/align_ylabels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def make_plot(axs):
5555
#
5656
#
5757
# Or we can manually align the axis labels between subplots manually using the
58-
# `~.YAxis.set_label_coords` method of the y-axis object. Note this requires
58+
# `~.Axis.set_label_coords` method of the y-axis object. Note this requires
5959
# we know a good offset value which is hardcoded.
6060

6161
fig,axs=plt.subplots(2,2)

‎lib/matplotlib/artist.py

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,8 @@ def _default_contains(self, mouseevent, figure=None):
393393
return inside, info
394394
# subclass-specific implementation follows
395395
396-
The`canvas` kwarg is provided for the implementation of
397-
`Figure.contains`.
396+
The*canvas* kwarg is provided for the implementation of
397+
`.Figure.contains`.
398398
"""
399399
ifcallable(self._contains):
400400
returnself._contains(self,mouseevent)
@@ -1293,24 +1293,6 @@ def get_valid_values(self, attr):
12931293

12941294
return'unknown'
12951295

1296-
def_get_setters_and_targets(self):
1297-
"""
1298-
Get the attribute strings and a full path to where the setter
1299-
is defined for all setters in an object.
1300-
"""
1301-
setters= []
1302-
fornameindir(self.o):
1303-
ifnotname.startswith('set_'):
1304-
continue
1305-
func=getattr(self.o,name)
1306-
if (notcallable(func)
1307-
orlen(inspect.signature(func).parameters)<2
1308-
orself.is_alias(func)):
1309-
continue
1310-
setters.append(
1311-
(name[4:],f"{func.__module__}.{func.__qualname__}"))
1312-
returnsetters
1313-
13141296
def_replace_path(self,source_class):
13151297
"""
13161298
Changes the full path to the public API path that is used
@@ -1327,7 +1309,17 @@ def get_setters(self):
13271309
Get the attribute strings with setters for object. e.g., for a line,
13281310
return ``['markerfacecolor', 'linewidth', ....]``.
13291311
"""
1330-
return [propforprop,targetinself._get_setters_and_targets()]
1312+
setters= []
1313+
fornameindir(self.o):
1314+
ifnotname.startswith('set_'):
1315+
continue
1316+
func=getattr(self.o,name)
1317+
if (notcallable(func)
1318+
orlen(inspect.signature(func).parameters)<2
1319+
orself.is_alias(func)):
1320+
continue
1321+
setters.append(name[4:])
1322+
returnsetters
13311323

13321324
defis_alias(self,o):
13331325
"""Return whether method object *o* is an alias for another method."""
@@ -1376,24 +1368,20 @@ def pprint_setters(self, prop=None, leadingspace=2):
13761368
accepts=self.get_valid_values(prop)
13771369
return'%s%s: %s'% (pad,prop,accepts)
13781370

1379-
attrs=self._get_setters_and_targets()
1380-
attrs.sort()
13811371
lines= []
1382-
1383-
forprop,pathinattrs:
1372+
forpropinsorted(self.get_setters()):
13841373
accepts=self.get_valid_values(prop)
13851374
name=self.aliased_name(prop)
1386-
13871375
lines.append('%s%s: %s'% (pad,name,accepts))
13881376
returnlines
13891377

13901378
defpprint_setters_rest(self,prop=None,leadingspace=4):
13911379
"""
1392-
If *prop* is *None*, return a list of strings of all settable
1393-
properties and their valid values. Format the output for ReST
1380+
If *prop* is *None*, return a list ofReST-formattedstrings of all
1381+
settableproperties and their valid values.
13941382
13951383
If *prop* is not *None*, it is a valid property name and that
1396-
property will be returned as a string of property : valid
1384+
property will be returned as a string of"property : valid"
13971385
values.
13981386
"""
13991387
ifleadingspace:
@@ -1404,13 +1392,24 @@ def pprint_setters_rest(self, prop=None, leadingspace=4):
14041392
accepts=self.get_valid_values(prop)
14051393
return'%s%s: %s'% (pad,prop,accepts)
14061394

1407-
attrs=sorted(self._get_setters_and_targets())
1408-
1409-
names= [self.aliased_name_rest(prop,target).replace(
1410-
'_base._AxesBase','Axes').replace(
1411-
'_axes.Axes','Axes')
1412-
forprop,targetinattrs]
1413-
accepts= [self.get_valid_values(prop)forprop,targetinattrs]
1395+
prop_and_qualnames= []
1396+
forpropinsorted(self.get_setters()):
1397+
# Find the parent method which actually provides the docstring.
1398+
forclsinself.o.__mro__:
1399+
method=getattr(cls,f"set_{prop}",None)
1400+
ifmethodandmethod.__doc__isnotNone:
1401+
break
1402+
else:# No docstring available.
1403+
method=getattr(self.o,f"set_{prop}")
1404+
prop_and_qualnames.append(
1405+
(prop,f"{method.__module__}.{method.__qualname__}"))
1406+
1407+
names= [self.aliased_name_rest(prop,target)
1408+
.replace('_base._AxesBase','Axes')
1409+
.replace('_axes.Axes','Axes')
1410+
forprop,targetinprop_and_qualnames]
1411+
accepts= [self.get_valid_values(prop)
1412+
forprop,_inprop_and_qualnames]
14141413

14151414
col0_len=max(len(n)forninnames)
14161415
col1_len=max(len(a)forainaccepts)

‎lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,7 @@ def _init_axis(self):
568568
self._update_transScale()
569569

570570
defset_figure(self,fig):
571-
"""
572-
Set the `.Figure` for this `.Axes`.
573-
574-
Parameters
575-
----------
576-
fig : `.Figure`
577-
"""
571+
# docstring inherited
578572
martist.Artist.set_figure(self,fig)
579573

580574
self.bbox=mtransforms.TransformedBbox(self._position,
@@ -2813,7 +2807,7 @@ def grid(self, b=None, which='major', axis='both', **kwargs):
28132807
grid is determined by the zorder of each axis, not by the zorder of the
28142808
`.Line2D` objects comprising the grid. Therefore, to set grid zorder,
28152809
use `.set_axisbelow` or, for more control, call the
2816-
`~matplotlib.axis.Axis.set_zorder` method of each axis.
2810+
`~.Artist.set_zorder` method of each axis.
28172811
"""
28182812
iflen(kwargs):
28192813
b=True

‎tutorials/introductory/lifecycle.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@
157157

158158
###############################################################################
159159
# Next, we'll add labels to the plot. To do this with the OO interface,
160-
# we can use the :meth:`axes.Axes.set` method to set properties of this
161-
# Axes object.
160+
# we can use the `.Artist.set` method to set properties of this Axes object.
162161

163162
fig,ax=plt.subplots()
164163
ax.barh(group_names,group_data)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp