Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cbb41a

Browse files
committed
Replace parameter lists with square brackets.
We now use standard numpydoc convention with curly braces.
1 parent cf45de8 commit 0cbb41a

11 files changed

Lines changed: 30 additions & 39 deletions

File tree

doc/devel/documenting_mpl.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,6 @@ omitted for string default values.
521521
If not provided, defaults to :rc:`figure.figsize` = ``[6.4, 4.8]``.
522522
If not provided, defaults to :rc:`figure.facecolor` = 'w'.
523523
524-
Deprecated formatting conventions
525-
---------------------------------
526-
Formerly, we have used square brackets for explicit parameter lists
527-
``['solid' | 'dashed' | 'dotted']``. With numpydoc we have switched to their
528-
standard using curly braces ``{'solid', 'dashed', 'dotted'}``.
529-
530524
Setters and getters
531525
-------------------
532526

examples/misc/set_and_get.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
name of the property you want to set without a value::
1919
2020
>>> plt.setp(line, 'linestyle')
21-
linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
21+
linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
2222
2323
If you want to see all the properties that can be set, and their
2424
possible values, you can do::

examples/specialty_plots/radar_chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def radar_factory(num_vars, frame='circle'):
3434
----------
3535
num_vars : int
3636
Number of variables for radar chart.
37-
frame : {'circle' | 'polygon'}
37+
frame : {'circle', 'polygon'}
3838
Shape of frame surrounding axes.
3939
4040
"""

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ def setp(obj, *args, **kwargs):
15361536
the name of the property you want to set without a value::
15371537
15381538
>>> setp(line, 'linestyle')
1539-
linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
1539+
linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
15401540
15411541
If you want to see all the properties that can be set, and their
15421542
possible values, you can do::

lib/matplotlib/axes/_base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,8 +2777,8 @@ def ticklabel_format(self, *, axis='both', style='', scilimits=None,
27772777
============== =========================================
27782778
Keyword Description
27792779
============== =========================================
2780-
*axis* [ 'x' | 'y' | 'both' ]
2781-
*style* [ 'sci' (or 'scientific') | 'plain' ]
2780+
*axis* {'x', 'y', 'both'}
2781+
*style* {'sci' (or 'scientific'), 'plain'}
27822782
plain turns off scientific notation
27832783
*scilimits* (m, n), pair of integers; if *style*
27842784
is 'sci', scientific notation will
@@ -2787,11 +2787,11 @@ def ticklabel_format(self, *, axis='both', style='', scilimits=None,
27872787
Use (0, 0) to include all numbers.
27882788
Use (m, m) where m != 0 to fix the order
27892789
of magnitude to 10\ :sup:`m`.
2790-
*useOffset* [ bool | offset ]; if True,
2791-
the offset will be calculated as needed;
2792-
if False, no offset will be used; if a
2793-
numeric offset is specified, it will be
2794-
used.
2790+
*useOffset* bool or float
2791+
If True, the offset will be calculated as
2792+
needed; if False, no offset will be used;
2793+
if a numeric offset is specified, it will
2794+
be used.
27952795
*useLocale* If True, format the number according to
27962796
the current locale. This affects things
27972797
such as the character used for the

lib/matplotlib/axis.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,12 +2365,7 @@ def set_offset_position(self, position):
23652365
position : {'left', 'right'}
23662366
"""
23672367
x, y = self.offsetText.get_position()
2368-
if position == 'left':
2369-
x = 0
2370-
elif position == 'right':
2371-
x = 1
2372-
else:
2373-
raise ValueError("Position accepts only [ 'left' | 'right' ]")
2368+
x = cbook._check_getitem({'left': 0, 'right': 1}, position=position)
23742369

23752370
self.offsetText.set_ha(position)
23762371
self.offsetText.set_position((x, y))

lib/matplotlib/collections.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,10 +1580,9 @@ def is_horizontal(self):
15801580
return self._is_horizontal
15811581

15821582
def get_orientation(self):
1583-
'''
1584-
get the orientation of the event line, may be:
1585-
[ 'horizontal' | 'vertical' ]
1586-
'''
1583+
"""
1584+
Return the orientation of the event line ('horizontal' or 'vertical').
1585+
"""
15871586
return 'horizontal' if self.is_horizontal() else 'vertical'
15881587

15891588
def switch_orientation(self):
@@ -1599,11 +1598,14 @@ def switch_orientation(self):
15991598
self.stale = True
16001599

16011600
def set_orientation(self, orientation=None):
1602-
'''
1603-
set the orientation of the event line
1604-
[ 'horizontal' | 'vertical' | None ]
1605-
defaults to 'horizontal' if not specified or None
1606-
'''
1601+
"""
1602+
Set the orientation of the event line.
1603+
1604+
Parameters
1605+
----------
1606+
orientation: {'horizontal', 'vertical'} or None
1607+
Defaults to 'horizontal' if not specified or None.
1608+
"""
16071609
if (orientation is None or orientation.lower() == 'none' or
16081610
orientation.lower() == 'horizontal'):
16091611
is_horizontal = True

lib/matplotlib/colorbar.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@
6666
============ ====================================================
6767
Property Description
6868
============ ====================================================
69-
*extend* [ 'neither' | 'both' | 'min' | 'max' ]
69+
*extend* {'neither', 'both', 'min', 'max'}
7070
If not 'neither', make pointed end(s) for out-of-
7171
range values. These are set for a given colormap
7272
using the colormap set_under and set_over methods.
73-
*extendfrac* [ *None* | 'auto' | length | lengths ]
73+
*extendfrac* {*None*, 'auto', length, lengths}
7474
If set to *None*, both the minimum and maximum
7575
triangular colorbar extensions with have a length of
7676
5% of the interior colorbar length (this is the
@@ -90,14 +90,14 @@
9090
If *False* the minimum and maximum colorbar extensions
9191
will be triangular (the default). If *True* the
9292
extensions will be rectangular.
93-
*spacing* [ 'uniform' | 'proportional' ]
93+
*spacing* {'uniform', 'proportional'}
9494
Uniform spacing gives each discrete color the same
9595
space; proportional makes the space proportional to
9696
the data interval.
97-
*ticks* [ None | list of ticks | Locator object ]
97+
*ticks* *None* or list of ticks or Locator
9898
If None, ticks are determined automatically from the
9999
input.
100-
*format* [ None | format string | Formatter object ]
100+
*format* None or str or Formatter
101101
If None, the
102102
:class:`~matplotlib.ticker.ScalarFormatter` is used.
103103
If a format string is given, e.g., '%.3f', that is

lib/matplotlib/mlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def detrend(x, key=None, axis=None):
151151
x : array or sequence
152152
Array or sequence containing the data.
153153
154-
key : [ 'default' | 'constant' | 'mean' | 'linear' | 'none'] or function
154+
key : {'default', 'constant', 'mean', 'linear', 'none'} or function
155155
Specifies the detrend algorithm to use. 'default' is 'mean', which is
156156
the same as `detrend_mean`. 'constant' is the same. 'linear' is
157157
the same as `detrend_linear`. 'none' is the same as

lib/matplotlib/scale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,6 @@ def _get_scale_docs():
772772

773773

774774
docstring.interpd.update(
775-
scale=' | '.join([repr(x) for x in get_scale_names()]),
775+
scale_type='{%s}' % ', '.join([repr(x) for x in get_scale_names()]),
776776
scale_docs=_get_scale_docs().rstrip(),
777777
)

0 commit comments

Comments
 (0)