Skip to content

Commit 50546de

Browse files
committed
Use numpydoc-style declaration of default param values
1 parent c7462bf commit 50546de

File tree

16 files changed

+687
-730
lines changed

16 files changed

+687
-730
lines changed

proplot/axes/base.py

Lines changed: 136 additions & 143 deletions
Large diffs are not rendered by default.

proplot/axes/cartesian.py

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959
``xscale=('cutoff', 100, 2)`` applies a `~proplot.scale.CutoffScale`.
6060
xscale_kw, yscale_kw : dict-like, optional
6161
The x and y axis scale settings. Passed to `~proplot.scale.Scale`.
62-
xmargin, ymargin, margin : float, optional
62+
xmargin, ymargin, margin : float, default: :rc:`margin`
6363
The default margin between plotted content and the x and y axis spines in
64-
axes-relative coordinates. Use this to add whitespace between plotted content and
65-
axes edges without explicitly setting the limits. Use `margin` to set both at once.
64+
axes-relative coordinates. This is useful if you don't witch to explicitly set
65+
axis limits. Use the keyword `margin` to set both at once.
6666
xbounds, ybounds : 2-tuple of float, optional
6767
The x and y axis data bounds within which to draw the spines. For example,
6868
``xlim=(0, 4)`` combined with ``xbounds=(2, 4)`` will prevent the spines
@@ -98,24 +98,24 @@
9898
xoffsetloc, yoffsetloc : {'left', 'right'}, optional
9999
Which x and y axis spines should have the axis offset indicator. Inherits from
100100
`ticklabelloc` by default (if `ticklabelloc` is a single side).
101-
xtickdir, ytickdir, tickdir : {'out', 'in', 'inout'}
101+
xtickdir, ytickdir, tickdir : {'out', 'in', 'inout'}, optional
102102
Direction that major and minor tick marks point for the x and y axis.
103-
Default is :rc:`tick.dir`. Use `tickdir` to control both.
104-
xticklabeldir, yticklabeldir : {'in', 'out'}
103+
Use the keyword `tickdir` to control both.
104+
xticklabeldir, yticklabeldir : {'in', 'out'}, optional
105105
Whether to place x and y axis tick label text inside or outside the axes.
106106
Propagates to `xtickdir` and `ytickdir` unless specified otherwise.
107-
xrotation, yrotation : float, optional
108-
The rotation for x and y axis tick labels. Default is ``0``
107+
xrotation, yrotation : float, default: 0
108+
The rotation for x and y axis tick labels.
109109
for normal axes, :rc:`formatter.timerotation` for time x axes.
110-
xgrid, ygrid, grid : bool, optional
110+
xgrid, ygrid, grid : bool, default: :rc:`grid`
111111
Whether to draw major gridlines on the x and y axis.
112-
Use `grid` to toggle both.
113-
xgridminor, ygridminor, gridminor : bool, optional
112+
Use the keyword `grid` to toggle both.
113+
xgridminor, ygridminor, gridminor : bool, default: :rc:`gridminor`
114114
Whether to draw minor gridlines for the x and y axis.
115-
Use `gridminor` to toggle both.
116-
xtickminor, ytickminor, tickminor : bool, optional
115+
Use the keyword `gridminor` to toggle both.
116+
xtickminor, ytickminor, tickminor : bool, default: :rc:`tick.minor`
117117
Whether to draw minor ticks on the x and y axes.
118-
Use `tickminor` to toggle both.
118+
Use the keyword `tickminor` to toggle both.
119119
xticks, yticks : optional
120120
Aliases for `xlocator`, `ylocator`.
121121
xlocator, ylocator : locator-spec, optional
@@ -136,72 +136,70 @@
136136
xformatter, yformatter : formatter-spec, optional
137137
Used to determine the x and y axis tick label string format.
138138
Passed to the `~proplot.constructor.Formatter` constructor.
139-
Can be string, list of strings, or `matplotlib.ticker.Formatter`
140-
instance. Use ``[]``, ``'null'``, or ``'none'`` for no labels.
139+
Can be string, list of strings, or `matplotlib.ticker.Formatter` instance.
140+
Use ``[]``, ``'null'``, or ``'none'`` for no labels.
141141
xformatter_kw, yformatter_kw : dict-like, optional
142142
Keyword arguments passed to the `matplotlib.ticker.Formatter` class.
143-
xcolor, ycolor, color : color-spec, optional
144-
Color for the x and y axis spines, ticks, tick labels, and axis
145-
labels. Use `color` to set both at once.
146-
xgridcolor, ygridcolor, gridcolor : color-spec, optional
147-
Color for the x and y axis major and minor gridlines. Default is :rc:`grid.color`.
148-
Use `gridcolor` to set both at once.
149-
xlinewidth, ylinewidth, linewidth : color-spec, optional
150-
Line width for the x and y axis spines and major ticks. Propagates to
151-
`tickwidth` unless specified otherwise. Use `linewidth` to set both at once.
152-
xtickcolor, ytickcolor, tickcolor : color-spec, optional
153-
Color for the x and y axis ticks. Default is `xcolor`, `ycolor`, and `color` or
154-
:rc:`tick.color` if they were not passed. Use `tickcolor` to set both at once.
155-
xticklen, yticklen, ticklen : unit-spec, optional
156-
Major tick lengths for the x and y axis. Default is :rc:`tick.len`.
143+
xcolor, ycolor, color : color-spec, default: :rc:`meta.color`
144+
Color for the x and y axis spines, ticks, tick labels, and axis labels.
145+
Use the keyword `color` to set both at once.
146+
xgridcolor, ygridcolor, gridcolor : color-spec, default: :rc:`grid.color`
147+
Color for the x and y axis major and minor gridlines.
148+
Use the keyword `gridcolor` to set both at once.
149+
xlinewidth, ylinewidth, linewidth : color-spec, default: :rc:`meta.width`
150+
Line width for the x and y axis spines and major ticks. Propagates to `tickwidth`
151+
unless specified otherwise. Use the keyword `linewidth` to set both at once.
152+
xtickcolor, ytickcolor, tickcolor : color-spec, default: :rc:`tick.color`
153+
Color for the x and y axis ticks. Defaults are `xcolor`, `ycolor`, and `color`
154+
if they were passed. Use the keyword `tickcolor` to set both at once.
155+
xticklen, yticklen, ticklen : unit-spec, default: :rc:`tick.len`
156+
Major tick lengths for the x and y axis.
157157
%(units.pt)s
158-
Use `ticklen` to set both at once.
159-
xticklenratio, yticklenratio, ticklenratio : float, optional
160-
Relative scaling of `xticklen` and `yticklen` used to determine
161-
minor tick lengths. Default is :rc:`tick.lenratio`.
162-
Use `ticklenratio` to set both at once.
163-
xtickwidth, ytickwidth, tickwidth, : unit-spec, optional
164-
Major tick widths for the x ans y axis. Default is `linewidth`
165-
or :rc:`tick.width` if `linewidth` was not passed.
158+
Use the keyword `ticklen` to set both at once.
159+
xticklenratio, yticklenratio, ticklenratio : float, default: :rc:`tick.lenratio`
160+
Relative scaling of `xticklen` and `yticklen` used to determine minor
161+
tick lengths. Use the keyword `ticklenratio` to set both at once.
162+
xtickwidth, ytickwidth, tickwidth, : unit-spec, default: :rc:`tick.width`
163+
Major tick widths for the x ans y axis. Default is `linewidth` if it was passed.
166164
%(units.pt)s
167-
Use `tickwidth` to set both at once.
168-
xtickwidthratio, ytickwidthratio, tickwidthratio
165+
Use the keyword `tickwidth` to set both at once.
166+
xtickwidthratio, ytickwidthratio, tickwidthratio : float, default: :rc:`tick.widthratio`
169167
Relative scaling of `xtickwidth` and `ytickwidth` used to determine
170-
minor tick widths. Default is :rc:`tick.widthratio`.
171-
Use `tickwidthratio` to set both at once.
172-
xticklabelpad, yticklabelpad : unit-spec, optional
173-
The padding between the x and y axis ticks and
174-
tick labels. Default is :rcraw:`tick.labelpad`.
168+
minor tick widths. Use the keyword `tickwidthratio` to set both at once.
169+
xticklabelpad, yticklabelpad, ticklabelpad : unit-spec, default: :rc:`tick.labelpad`
170+
The padding between the x and y axis ticks and tick labels. Use the
171+
keyword `ticklabelpad` to set both at once.
175172
%(units.pt)s
176-
xticklabelcolor, yticklabelcolor, ticklabelcolor : color-spec, optional
177-
Color for the x and y tick labels. Default is `xcolor`, `ycolor`, and `color` or
178-
:rc:`tick.labelcolor` if they were not passed. Use `ticklabelcolor` to set both.
179-
xticklabelsize, yticklabelsize, ticklabelsize : unit-spec or str, optional
180-
Font size for the x and y tick labels. Default is :rc:`tick.labelsize`.
173+
xticklabelcolor, yticklabelcolor, ticklabelcolor \
174+
: color-spec, default: :rc:`tick.labelcolor`
175+
Color for the x and y tick labels. Defaults are `xcolor`, `ycolor`, and `color`
176+
if they were passed. Use the keyword `ticklabelcolor` to set both at once.
177+
xticklabelsize, yticklabelsize, ticklabelsize \
178+
: unit-spec or str, default: :rc:`tick.labelsize`
179+
Font size for the x and y tick labels.
181180
%(units.pt)s
182-
Use `ticklabelsize` to set both at once.
183-
xticklabelweight, yticklabelweight, ticklabelweight : str, optional
184-
Font weight for the x and y axis labels. Default is :rc:`label.weight`.
185-
Use `ticklabelweight` to set both at once.
186-
xlabelpad, ylabelpad : unit-spec, optional
187-
The padding between the x and y axis bounding box and
188-
the x and y axis labels. Default is :rc:`label.pad`.
181+
Use the keyword `ticklabelsize` to set both at once.
182+
xticklabelweight, yticklabelweight, ticklabelweight \
183+
: str, default: :rc:`tick.labelweight`
184+
Font weight for the x and y tick labels.
185+
Use the keyword `ticklabelweight` to set both at once.
186+
xlabelpad, ylabelpad : unit-spec, default: :rc:`label.pad`
187+
The padding between the x and y axis bounding box and the x and y axis labels.
189188
%(units.pt)s
190-
xlabelcolor, ylabelcolor, labelcolor : color-spec, optional
191-
Color for the x and y axis labels. Default is `xcolor`, `ycolor`, and `color` or
192-
:rc:`label.color` if they were not passed. Use `labelcolor` to set both at once.
193-
xlabelsize, ylabelsize, labelsize : unit-spec or str, optional
194-
Font size for the x and y axis labels. Default is :rc:`label.size`.
189+
xlabelcolor, ylabelcolor, labelcolor : color-spec, default: :rc:`label.color`
190+
Color for the x and y axis labels. Defaults are `xcolor`, `ycolor`, and `color`
191+
if they were passed. Use the keyword `labelcolor` to set both at once.
192+
xlabelsize, ylabelsize, labelsize : unit-spec or str, default: :rc:`label.size`
193+
Font size for the x and y axis labels.
195194
%(units.pt)s
196-
Use `labelsize` to set both at once.
197-
xlabelweight, ylabelweight, labelweight : str, optional
198-
Font weight for the x and y axis labels. Default is :rc:`label.weight`.
199-
Use `labelweight` to set both at once.
200-
fixticks : bool, optional
201-
Whether to always transform the tick locators to a
202-
`~matplotlib.ticker.FixedLocator` instance. Default is ``False``.
203-
If your axis ticks are doing weird things (for example, ticks
204-
drawn outside of the axis spine), try setting this to ``True``.
195+
Use the keyword `labelsize` to set both at once.
196+
xlabelweight, ylabelweight, labelweight : str, default: :rc:`label.weight`
197+
Font weight for the x and y axis labels.
198+
Use the keyword `labelweight` to set both at once.
199+
fixticks : bool, default: False
200+
Whether to transform the tick locators to a `~matplotlib.ticker.FixedLocator`.
201+
If your axis ticks are doing weird things (for example, ticks are drawn
202+
outside of the axis spine) you can try setting this to ``True``.
205203
"""
206204
docstring._snippet_manager['cartesian.format'] = _format_docstring
207205

proplot/axes/geo.py

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
South Pole-centered projections.
5252
Basemap bounding latitudes must be declared by passing keyword arguments
5353
to `~proplot.constructor.Proj`.
54-
longrid, latgrid : bool, optional
54+
longrid, latgrid, grid : bool, default: :rc:`grid`
5555
Whether to draw longitude and latitude gridlines.
56-
Default is :rc:`grid`. Use `grid` to toggle both.
57-
longridminor, latgridminor : bool, optional
56+
Use the keyword `grid` to toggle both.
57+
longridminor, latgridminor, gridminor : bool, default: :rc:`gridminor`
5858
Whether to draw "minor" longitude and latitude lines.
59-
Default is :rc:`gridminor`. Use `gridminor` to toggle both.
59+
Use the keyword `gridminor` to toggle both.
6060
lonlines, latlines : optional
6161
Aliases for `lonlocator`, `latlocator`.
6262
lonlocator, latlocator : locator-spec, optional
@@ -76,19 +76,17 @@
7676
Keyword arguments passed to the `matplotlib.ticker.Locator` class.
7777
lonminorlocator, latminorlocator, lonminorlines, latminorlines : optional
7878
As with `lonlocator` and `latlocator` but for the "minor" gridlines.
79-
The defaults are :rc:`grid.lonminorstep` and :rc:`grid.latminorstep`.
8079
lonminorlines_kw, latminorlines_kw : optional
8180
Aliases for `lonminorlocator_kw`, `latminorlocator_kw`.
8281
lonminorlocator_kw, latminorlocator_kw : optional
8382
As with `lonlocator_kw` and `latlocator_kw` but for the "minor" gridlines.
84-
latmax : float, optional
83+
latmax : float, default: 80
8584
The maximum absolute latitude for longitude and latitude gridlines.
8685
Longitude gridlines are cut off poleward of this latitude for *all*
8786
basemap projections and cartopy projections predating cartopy 0.18.
88-
Default is ``80``.
89-
labels : bool, optional
90-
Sets `lonlabels` and `latlabels` to ``True``. Default is :rc:`grid.labels`.
91-
To draw labels by default use e.g. ``pplt.rc['grid.labels'] = True``.
87+
labels : bool, default: :rc:`grid.labels`
88+
Sets `lonlabels` and `latlabels` to ``True``. To draw labels
89+
by default use e.g. ``pplt.rc['grid.labels'] = True``.
9290
lonlabels, latlabels : optional
9391
Whether to label longitudes and latitudes, and on which sides
9492
of the map. There are four different options:
@@ -123,32 +121,27 @@
123121
and "seconds" rather than decimal degrees.
124122
lonformatter_kw, latformatter_kw : dict-like, optional
125123
Keyword arguments passed to the `matplotlib.ticker.Formatter` class.
126-
loninline, latinline, inlinelabels : bool, optional
124+
loninline, latinline, inlinelabels : bool, default: :rc:`grid.inlinelabels`
127125
*For cartopy axes only.*
128-
Whether to draw inline longitude and latitude gridline labels. Default is
129-
:rc:`grid.inlinelabels`. Setting these to ``True`` also sets the default
130-
values for `lonlabels`, `latlabels`, and `labels` to ``True`` (respectively).
131-
rotatelabels : bool, optional
126+
Whether to draw inline longitude and latitude gridline labels. Setting to ``True``
127+
also sets default values for `lonlabels`, `latlabels`, and `labels` to ``True``.
128+
rotatelabels : bool, default: :rc:`grid.rotatelabels`
132129
*For cartopy axes only.*
133-
Whether to rotate longitude and latitude gridline
134-
labels. Default is :rc:`grid.rotatelabels`.
135-
labelpad : unit-spec, optional
130+
Whether to rotate longitude and latitude gridline labels.
131+
labelpad : unit-spec, default: :rc:`grid.labelpad`
136132
*For cartopy axes only.*
137-
The padding between the map boundary and longitude and
138-
latitude gridline labels. Default is :rc:`grid.labelpad`.
133+
The padding between the map boundary and longitude and latitude gridline labels.
139134
%(units.pt)s
140-
dms : bool, optional
135+
dms : bool, default: :rc:`grid.dmslabels`
141136
*For cartopy axes only.*
142137
Specifies whether the default locators and formatters should use
143138
"minutes" and "seconds" for gridline labels on small scales rather
144139
than decimal degrees. Setting this to ``False`` is equivalent to
145140
specifying ``ax.format(lonlocator='deglon', latlocator='deglon')``
146141
and ``ax.format(lonformatter='deglon', latformatter='deglat')``.
147-
Default is :rc:`grid.dmslabels`.
148-
nsteps : int, optional
142+
nsteps : int, default: :rc:`grid.nsteps`
149143
*For cartopy axes only.*
150144
The number of interpolation steps used to draw gridlines.
151-
Default is :rc:`grid.nsteps`.
152145
land, ocean, coast, rivers, lakes, borders, innerborders : bool, optional
153146
Toggles various geographic features. These are actually the
154147
:rcraw:`land`, :rcraw:`ocean`, :rcraw:`coast`, :rcraw:`rivers`,
@@ -163,17 +156,18 @@
163156
*For cartopy axes only.*
164157
The resolution of geographic features. For basemap axes, this must
165158
be passed to `~proplot.constructor.Proj`.
166-
color : color-spec, optional
167-
Color for the axes edge. Propagates to `labelcolor` unless
168-
specified otherwise (similar to `proplot.axes.CartesianAxes.format`).
169-
labelcolor, gridlabelcolor : color-spec, optional
170-
Color for the grid labels. Default is `color` or :rc:`grid.labelcolor`
171-
if `color` was not passed.
172-
labelsize, gridlabelsize : unit-spec or str, optional
173-
Font size for the gridline labels. Default is :rc:`grid.labelsize`.
159+
color : color-spec, default: :rc:`meta.color`
160+
Color for the axes edge. Propagates to `labelcolor` unless specified
161+
otherwise (similar to `proplot.axes.CartesianAxes.format`).
162+
gridcolor : color-spec, default: :rc:`grid.color`
163+
Color for the longitude and lagitude grid lines.
164+
labelcolor, gridlabelcolor : color-spec, default: `color` or :rc:`grid.labelcolor`
165+
Color for the longitude and latitude grid labels.
166+
labelsize, gridlabelsize : unit-spec or str, default: :rc:`grid.labelsize`
167+
Font size for the gridline labels.
174168
%(units.pt)s
175-
labelweight, gridlabelweight : str, optional
176-
Font weight for the gridline labels. Default is :rc:`grid.labelweight`.
169+
labelweight, gridlabelweight : str, default: :rc:`grid.labelweight`
170+
Font weight for the gridline labels.
177171
"""
178172
docstring._snippet_manager['geo.format'] = _format_docstring
179173

@@ -407,17 +401,16 @@ def __init__(self, *args, **kwargs):
407401
----------
408402
*args
409403
Passed to `matplotlib.axes.Axes`.
410-
autoextent : bool, optional
404+
autoextent : bool, default: :rc:`cartopy.autoextent`
411405
*For cartopy axes only*. Whether to automatically adjust map bounds
412406
based on plotted content or enforce a global map extent (or a map bounded
413407
at the equator for polar projections). The extent can subsequently by
414408
adjusted with the `~GeoAxes.format` keywords `lonlim`, `latlim`, and
415409
`boundinglat`, or with `~cartopy.mpl.geoaxes.GeoAxes.set_extent`.
416-
Default is :rc:`cartopy.autoextent`.
417-
circular : bool, optional
418-
*For cartopy axes only*. Whether to bound polar projections with circles
419-
rather than squares. Note that outer gridline labels cannot be added to
420-
circularly bounded polar projections. Default is :rc:`cartopy.circular`.
410+
circular : bool, default: :rc:`cartopy.circular`
411+
*For cartopy axes only*. Whether to bound polar projections with
412+
circles rather than squares. Note that outer gridline labels cannot
413+
be added to circularly bounded polar projections.
421414
map_projection : `~cartopy.crs.Projection` or `~mpl_toolkits.basemap.Basemap`
422415
The cartopy or basemap projection instance. This is
423416
passed automatically when calling axes-creation

0 commit comments

Comments
 (0)