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

Skip to content

Commit f0e7db5

Browse files
authored
Update Axis docs (#13322)
1 parent 423dc26 commit f0e7db5

1 file changed

Lines changed: 49 additions & 12 deletions

File tree

lib/matplotlib/axis.py

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,16 @@ def get_view_interval(self):
633633

634634

635635
class Ticker(object):
636+
"""
637+
A container for the objects defining tick position and format.
638+
639+
Attributes
640+
----------
641+
locator : `matplotlib.ticker.Locator` subclass
642+
Determines the positions of the ticks.
643+
formatter : `matplotlib.ticker.Formatter` subclass
644+
Determines the format of the tick labels.
645+
"""
636646
locator = None
637647
formatter = None
638648

@@ -671,11 +681,33 @@ def __get__(self, instance, cls):
671681

672682
class Axis(martist.Artist):
673683
"""
674-
Public attributes
684+
Base class for `.XAxis` and `.YAxis`.
675685
676-
* :attr:`axes.transData` - transform data coords to display coords
677-
* :attr:`axes.transAxes` - transform axis coords to display coords
678-
* :attr:`labelpad` - number of points between the axis and its label
686+
Attributes
687+
----------
688+
isDefault_label : bool
689+
690+
axes : `matplotlib.axes.Axes`
691+
The `~.axes.Axes` to which the Axis belongs.
692+
major : `matplotlib.axis.Ticker`
693+
Determines the major tick positions and their label format.
694+
minor : `matplotlib.axis.Ticker`
695+
Determines the minor tick positions and their label format.
696+
callbacks : `matplotlib.cbook.CallbackRegistry`
697+
698+
label : `.Text`
699+
The axis label.
700+
labelpad : float
701+
The distance between the axis label and the tick labels.
702+
Defaults to :rc:`axes.labelpad` = 4.
703+
offsetText : `.Text`
704+
A `.Text` object containing the data offset of the ticks (if any).
705+
pickradius : float
706+
The acceptance radius for containment tests. See also `.Axis.contains`.
707+
majorTicks : list of `.Tick`
708+
The major ticks.
709+
minorTicks : list of `.Tick`
710+
The minor ticks.
679711
"""
680712
OFFSETTEXTPAD = 3
681713

@@ -685,7 +717,13 @@ def __str__(self):
685717

686718
def __init__(self, axes, pickradius=15):
687719
"""
688-
Init the axis with the parent Axes instance
720+
Parameters
721+
----------
722+
axes : `matplotlib.axes.Axes`
723+
The `~.axes.Axes` to which the created Axis belongs.
724+
pickradius : float
725+
The acceptance radius for containment tests. See also
726+
`.Axis.contains`.
689727
"""
690728
martist.Artist.__init__(self)
691729
self.set_figure(axes.figure)
@@ -721,19 +759,18 @@ def __init__(self, axes, pickradius=15):
721759

722760
def set_label_coords(self, x, y, transform=None):
723761
"""
724-
Set the coordinates of the label. By default, the x
725-
coordinate of the y label is determined by the tick label
726-
bounding boxes, but this can lead to poor alignment of
727-
multiple ylabels if there are multiple axes. Ditto for the y
728-
coordinate of the x label.
762+
Set the coordinates of the label.
763+
764+
By default, the x coordinate of the y label is determined by the tick
765+
label bounding boxes, but this can lead to poor alignment of multiple
766+
ylabels if there are multiple axes. Ditto for the y coordinate of
767+
the x label.
729768
730769
You can also specify the coordinate system of the label with
731770
the transform. If None, the default coordinate system will be
732771
the axes coordinate system (0,0) is (left,bottom), (0.5, 0.5)
733772
is middle, etc
734-
735773
"""
736-
737774
self._autolabelpos = False
738775
if transform is None:
739776
transform = self.axes.transAxes

0 commit comments

Comments
 (0)