8000 Merge pull request #14035 from anntzer/interpd · matplotlib/matplotlib@6f1ffeb · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f1ffeb

Browse files
authored
Merge pull request #14035 from anntzer/interpd
Improve proper 8000 ties formatting in interpolated docstrings.
2 parents 01ad461 + 77a9633 commit 6f1ffeb

File tree

10 files changed

+29
-27
lines changed

10 files changed

+29
-27
lines changed

lib/matplotlib/artist.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,12 +1575,10 @@ def kwdoc(artist):
15751575
:rc:`docstring.hardcopy` is False and as a rst table (intended for
15761576
use in Sphinx) if it is True.
15771577
"""
1578-
hardcopy = matplotlib.rcParams['docstring.hardcopy']
1579-
if hardcopy:
1580-
return '\n'.join(ArtistInspector(artist).pprint_setters_rest(
1581-
leadingspace=4))
1582-
else:
1583-
return '\n'.join(ArtistInspector(artist).pprint_setters(
1584-
leadingspace=2))
1578+
ai = ArtistInspector(artist)
1579+
return ('\n'.join(ai.pprint_setters_rest(leadingspace=4))
1580+
if matplotlib.rcParams['docstring.hardcopy'] else
1581+
'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
1582+
15851583

15861584
docstring.interpd.update(Artist=kwdoc(Artist))

lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ def legend(self, *args, **kwargs):
393393
--------
394394
395395
.. plot:: gallery/text_labels_and_annotations/legend.py
396-
397396
"""
398397
handles, labels, extra_args, kwargs = mlegend._parse_legend_args(
399398
[self],
@@ -645,15 +644,12 @@ def secondary_xaxis(self, location, *, functions=None, **kwargs):
645644
ax.loglog(range(1, 360, 5), range(1, 360, 5))
646645
ax.set_xlabel('frequency [Hz]')
647646
648-
649647
def invert(x):
650648
return 1 / x
651649
652650
secax = ax.secondary_xaxis('top', functions=(invert, invert))
653651
secax.set_xlabel('Period [s]')
654652
plt.show()
655-
656-
657653
"""
658654
if (location in ['top', 'bottom'] or isinstance(location, Number)):
659655
secondary_ax = SecondaryAxis(self, 'x', location, functions,
@@ -686,7 +682,6 @@ def secondary_yaxis(self, location, *, functions=None, **kwargs):
686682
secax = ax.secondary_yaxis('right', functions=(np.deg2rad,
687683
np.rad2deg))
688684
secax.set_ylabel('radians')
689-
690685
"""
691686
if location in ['left', 'right'] or isinstance(location, Number):
692687
secondary_ax = SecondaryAxis(self, 'y', location,
@@ -845,7 +840,6 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
845840
the xrange::
846841
847842
>>> axhline(y=.5, xmin=0.25, xmax=0.75)
848-
849843
"""
850844
if "transform" in kwargs:
851845
raise ValueError(
@@ -1714,15 +1708,13 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
17141708
17151709
%(_Line2D_docstr)s
17161710
1717-
17181711
See Also
17191712
--------
17201713
matplotlib.dates : Helper functions on dates.
17211714
matplotlib.dates.date2num : Convert dates to num.
17221715
matplotlib.dates.num2date : Convert num to dates.
17231716
matplotlib.dates.drange : Create an equally spaced sequence of dates.
17241717
1725-
17261718
Notes
17271719
-----
17281720
If you are using custom date tickers and formatters, it may be
@@ -2294,7 +2286,6 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22942286
Other optional kwargs:
22952287
22962288
%(Rectangle)s
2297-
22982289
"""
22992290
kwargs = cbook.normalize_kwargs(kwargs, mpatches.Patch)
23002291
color = kwargs.pop('color', None)
@@ -2588,7 +2579,6 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
25882579
Other optional kwargs:
25892580
25902581
%(Rectangle)s
2591-
25922582
"""
25932583
kwargs.setdefault('orientation', 'horizontal')
25942584
patches = self.bar(x=left, height=height, width=width, bottom=y,
@@ -3203,7 +3193,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
32033193
Valid kwargs for the marker properties are `.Lines2D` properties:
32043194
32053195
%(_Line2D_docstr)s
3206-
32073196
"""
32083197
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
32093198
# anything that comes in as 'None', drop so the default thing
@@ -4642,7 +4631,6 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
46424631
:class:`~matplotlib.collections.Collection` parameters:
46434632
46444633
%(Collection)s
4645-
46464634
"""
46474635
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
46484636

@@ -6059,7 +6047,6 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
60596047
60606048
%(QuadMesh)s
60616049
6062-
60636050
See Also
60646051
--------
60656052
pcolor : An alternative implementation with slightly different

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ def __init__(self, fig, rect,
440440
441441
**kwargs
442442
Other optional keyword arguments:
443+
443444
%(Axes)s
444445
445446
Returns

lib/matplotlib/figure.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,7 @@ def add_axes(self, *args, **kwargs):
11721172
the following table but there might also be other keyword
11731173
arguments if another projection is used, see the actual axes
11741174
class.
1175+
11751176
%(Axes)s
11761177
11771178
Returns
@@ -1315,6 +1316,7 @@ def add_subplot(self, *args, **kwargs):
13151316
rectilinear base class `~.axes.Axes` can be found in
13161317
the following table but there might also be other keyword
13171318
arguments if another projection is used.
1319+
13181320
%(Axes)s
13191321
13201322
Returns
@@ -1859,6 +1861,7 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
18591861
----------------
18601862
**kwargs : `~matplotlib.text.Text` properties
18611863
Other miscellaneous text parameters.
1864+
18621865
%(Text)s
18631866
18641867
Returns

lib/matplotlib/patches.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ def __init__(self, patch, ox, oy, props=None, **kwargs):
605605
but darkened.
606606
607607
kwargs are
608+
608609
%(Patch)s
609610
"""
610611
Patch.__init__(self)
@@ -686,6 +687,7 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
686687
Notes
687688
-----
688689
Valid kwargs are:
690+
689691
%(Patch)s
690692
"""
691693

@@ -853,6 +855,7 @@ def __init__(self, xy, numVertices, radius=5, orientation=0,
853855
rotates the polygon (in radians).
854856
855857
Valid kwargs are:
858+
856859
%(Patch)s
857860
"""
858861
self._xy = xy
@@ -930,6 +933,7 @@ def __init__(self, path, **kwargs):
930933
*path* is a :class:`matplotlib.path.Path` object.
931934
932935
Valid kwargs are:
936+
933937
%(Patch)s
934938
"""
935939
Patch.__init__(self, **kwargs)
@@ -956,6 +960,7 @@ def __init__(self, xy, closed=True, **kwargs):
956960
starting and ending points are the same.
957961
958962
Valid kwargs are:
963+
959964
%(Patch)s
960965
"""
961966
Patch.__init__(self, **kwargs)
@@ -1232,8 +1237,8 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
12321237
instead of ending at coordinate 0.
12331238
12341239
Other valid kwargs (inherited from :class:`Patch`) are:
1235-
%(Patch)s
12361240
1241+
%(Patch)s
12371242
"""
12381243
if head_width is None:
12391244
head_width = 3 * width
@@ -1313,8 +1318,8 @@ def __init__(self, xy, radius=5,
13131318
see :class:`~matplotlib.patches.Circle`.
13141319
13151320
Valid kwargs are:
1316-
%(Patch)s
13171321
1322+
%(Patch)s
13181323
"""
13191324
RegularPolygon.__init__(self, xy,
13201325
resolution,
@@ -1350,6 +1355,7 @@ def __init__(self, xy, width, height, angle=0, **kwargs):
13501355
Notes
13511356
-----
13521357
Valid keyword arguments are
1358+
13531359
%(Patch)s
13541360
"""
13551361
Patch.__init__(self, **kwargs)
@@ -1424,8 +1430,8 @@ def __init__(self, xy, radius=5, **kwargs):
14241430
and is much closer to a scale-free circle.
14251431
14261432
Valid kwargs are:
1427-
%(Patch)s
14281433
1434+
%(Patch)s
14291435
"""
14301436
Ellipse.__init__(self, xy, radius * 2, radius * 2, **kwargs)
14311437
self.radius = radius
@@ -1505,7 +1511,6 @@ def __init__(self, xy, width, height, angle=0.0,
15051511
not supported.
15061512
15071513
%(Patch)s
1508-
15091514
"""
15101515
fill = kwargs.setdefault('fill', False)
15111516
if fill:
@@ -2606,7 +2611,6 @@ class ConnectionStyle(_Style):
26062611
26072612
%(AvailableConnectorstyles)s
26082613
2609-
26102614
An instance of any connection style class is an callable object,
26112615
whose call signature is::
26122616
@@ -3051,7 +3055,6 @@ class ArrowStyle(_Style):
30513055
30523056
%(AvailableArrowstyles)s
30533057
3054-
30553058
An instance of any arrow style class is a callable object,
30563059
whose call signature is::
30573060

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ def axes(arg=None, **kwargs):
783783
the following table but there might also be other keyword
784784
arguments if another projection is used, see the actual axes
785785
class.
786+
786787
%(Axes)s
787788
788789
Returns
@@ -933,6 +934,7 @@ def subplot(*args, **kwargs):
933934
rectilinear base class `~.axes.Axes` can be found in
934935
the following table but there might also be other keyword
935936
arguments if another projection is used.
937+
936938
%(Axes)s
937939
938940
Returns

lib/matplotlib/spines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __init__(self, axes, spine_type, path, **kwargs):
3939
- *path* : the path instance used to draw the spine
4040
4141
Valid kwargs are:
42+
4243
%(Patch)s
4344
"""
4445
super().__init__(**kwargs)

lib/matplotlib/table.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def set_text_props(self, **kwargs):
172172
Update the text properties.
173173
174174
Valid kwargs are
175+
175176
%(Text)s
176177
"""
177178
self._text.update(kwargs)

lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ def __init__(self,
136136
Create a `.Text` instance at *x*, *y* with string *text*.
137137
138138
Valid kwargs are
139+
139140
%(Text)s
140141
"""
141-
142142
Artist.__init__(self)
143143
self._x, self._y = x, y
144144

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def __init__(self, bbox, **kwargs):
151151
152152
**kwargs
153153
Patch properties. Valid arguments include:
154+
154155
%(Patch)s
155156
"""
156157
if "transform" in kwargs:
@@ -294,6 +295,7 @@ def __init__(self, bbox1, bbox2, loc1, loc2=None, **kwargs):
294295
295296
**kwargs
296297
Patch properties for the line drawn. Valid arguments include:
298+
297299
%(Patch)s
298300
"""
299301
if "transform" in kwargs:
@@ -352,6 +354,7 @@ def __init__(self, bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs):
352354
353355
**kwargs
354356
Patch properties for the line drawn:
357+
355358
%(Patch)s
356359
"""
357360
if "transform" in kwargs:
@@ -471,6 +474,7 @@ def inset_axes(parent_axes, width, height, loc='upper right',
471474
axes_kwargs : dict, optional
472475
Keyworded arguments to pass to the constructor of the inset axes.
473476
Valid arguments include:
477+
474478
%(Axes)s
475479
476480
borderpad : float, optional
@@ -588,6 +592,7 @@ def zoomed_inset_axes(parent_axes, zoom, loc='upper right',
588592
axes_kwargs : dict, optional
589593
Keyworded arguments to pass to the constructor of the inset axes.
590594
Valid arguments include:
595+
591596
%(Axes)s
592597
593598
borderpad : float, optional
@@ -644,6 +649,7 @@ def mark_inset(parent_axes, inset_axes, loc1, loc2, **kwargs):
644649
645650
**kwargs
646651
Patch properties for the lines and box drawn:
652+
647653
%(Patch)s
648654
649655
Returns

0 commit comments

Comments
 (0)
0