8000 Merge pull request #24243 from oscargus/tickerdocs · matplotlib/matplotlib@26949d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26949d5

Browse files
authored
Merge pull request #24243 from oscargus/tickerdocs
Improve documentation for ticker
2 parents 3a5c6dc + a400015 commit 26949d5

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

lib/matplotlib/ticker.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,10 +1707,10 @@ def tick_values(self, vmin, vmax):
17071707

17081708
class FixedLocator(Locator):
17091709
"""
1710-
Tick locations are fixed. If nbins is not None,
1711-
the array of possible positions will be subsampled to
1712-
keep the number of ticks <= nbins +1.
1713-
The subsampling will be done so as to include the smallest
1710+
Tick locations are fixed at *locs*. If *nbins* is not None,
1711+
the *locs* array of possible positions will be subsampled to
1712+
keep the number of ticks <= *nbins* +1.
1713+
The subsampling will be done to include the smallest
17141714
absolute value; for example, if zero is included in the
17151715
array of possibilities, then it is guaranteed to be one of
17161716
the chosen ticks.
@@ -1774,14 +1774,21 @@ class LinearLocator(Locator):
17741774
Determine the tick locations
17751775
17761776
The first time this function is called it will try to set the
1777-
number of ticks to make a nice tick partitioning. Thereafter the
1777+
number of ticks to make a nice tick partitioning. Thereafter, the
17781778
number of ticks will be fixed so that interactive navigation will
17791779
be nice
17801780
17811781
"""
17821782
def __init__(self, numticks=None, presets=None):
17831783
"""
1784-
Use presets to set locs based on lom. A dict mapping vmin, vmax->locs
1784+
Parameters
1785+
----------
1786+
numticks : int or None, default None
1787+
Number of ticks. If None, *numticks* = 11.
1788+
presets : dict or None, default: None
1789+
Dictionary mapping ``(vmin, vmax)`` to an array of locations.
1790+
Overrides *numticks* if there is an entry for the current
1791+
``(vmin, vmax)``.
17851792
"""
17861793
self.numticks = numticks
17871794
if presets is None:
@@ -1847,7 +1854,8 @@ def view_limits(self, vmin, vmax):
18471854

18481855
class MultipleLocator(Locator):
18491856
"""
1850-
Set a tick on each integer multiple of a base within the view interval.
1857+
Set a tick on each integer multiple of the *base* within the view
1858+
interval.
18511859
"""
18521860

18531861
def __init__(self, base=1.0):
@@ -1874,7 +1882,7 @@ def tick_values(self, vmin, vmax):
18741882

18751883
def view_limits(self, dmin, dmax):
18761884
"""
1877-
Set the view limits to 8000 the nearest multiples of base that
1885+
Set the view limits to the nearest multiples of *base* that
18781886
contain the data.
18791887
"""
18801888
if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
@@ -1903,16 +1911,20 @@ def scale_range(vmin, vmax, n=1, threshold=100):
19031911

19041912
class _Edge_integer:
19051913
"""
1906-
Helper for MaxNLocator, MultipleLocator, etc.
1914+
Helper for `.MaxNLocator`, `.MultipleLocator`, etc.
19071915
1908-
Take floating point precision limitations into account when calculating
1916+
Take floating-point precision limitations into account when calculating
19091917
tick locations as integer multiples of a step.
19101918
"""
19111919
def __init__(self, step, offset):
19121920
"""
1913-
*step* is a positive floating-point interval between ticks.
1914-
*offset* is the offset subtracted from the data limits
1915-
prior to calculating tick locations.
1921+
Parameters
1922+
----------
1923+
step : float > 0
1924+
Interval between ticks.
1925+
offset : float
1926+
Offset subtracted from the data limits prior to calculating tick
1927+
locations.
19161928
"""
19171929
if step <= 0:
19181930
raise ValueError("'step' must be positive")
@@ -1946,8 +1958,8 @@ def ge(self, x):
19461958

19471959
class MaxNLocator(Locator):
19481960
"""
1949-
Find nice tick locations with no more than N being within the view limits.
1950-
Locations beyond the limits are added to support autoscaling.
1961+
Find nice tick locations with no more than *nbins* + 1 being within the
1962+
view limits. Locations beyond the limits are added to support autoscaling.
19511963
"""
19521964
default_params = dict(nbins=10,
19531965
steps=None,

0 commit comments

Comments
 (0)
0