Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
[Doc] Improve axisartist documentation#27351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -142,8 +142,6 @@ def get_axislabel_transform(self, axes): | ||
def get_axislabel_pos_angle(self, axes): | ||
""" | ||
Return the label reference position in transAxes. | ||
""" | ||
return dict(left=((0., 0.5), 90), # (position, angle_tangent) | ||
right=((1., 0.5), 90), | ||
@@ -174,8 +172,11 @@ class FixedAxisArtistHelperRectilinear(_FixedAxisArtistHelperBase): | ||
@_api.delete_parameter("3.9", "nth_coord") | ||
def __init__(self, axes, loc, nth_coord=None): | ||
""" | ||
Parameters | ||
---------- | ||
axes : `mpl_toolkits.axisartist.axislines.Axes` | ||
loc : ["left", "right", "top", "bottom"] | ||
""" | ||
super().__init__(loc) | ||
self.axis = [axes.xaxis, axes.yaxis][self.nth_coord] | ||
@@ -211,6 +212,16 @@ class FloatingAxisArtistHelperRectilinear(_FloatingAxisArtistHelperBase): | ||
def __init__(self, axes, nth_coord, | ||
passingthrough_point, axis_direction="bottom"): | ||
""" | ||
Parameters | ||
---------- | ||
axes : `mpl_toolkits.axisartist.axislines.Axes` | ||
nth_coord : {0, 1}, optional | ||
Along which coordinate the value varies in 2D. 0: x-axis, 1: y-axis. | ||
passingthrough_point : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Rename to "value" for consistency with the parent class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I was considering the other way around, since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I think it would be much simpler to document | ||
axis_direction : ["left", "right", "top", "bottom"], default: "bottom" | ||
""" | ||
super().__init__(nth_coord, passingthrough_point) | ||
self._axis_direction = axis_direction | ||
self.axis = [axes.xaxis, axes.yaxis][self.nth_coord] | ||
@@ -230,8 +241,6 @@ def get_axislabel_transform(self, axes): | ||
def get_axislabel_pos_angle(self, axes): | ||
""" | ||
Return the label reference position in transAxes. | ||
""" | ||
angle = [0, 90][self.nth_coord] | ||
fixed_coord = 1 - self.nth_coord | ||
@@ -315,6 +324,20 @@ def __init__(self, axes): | ||
"3.9", "nth_coord", addendum="'nth_coord' is now inferred from 'loc'.") | ||
def new_fixed_axis( | ||
self, loc, nth_coord=None, axis_direction=None, offset=None, axes=None): | ||
""" | ||
Parameters | ||
---------- | ||
loc : ["left", "right", "top", "bottom"] | ||
axis_direction : ["left", "right", "top", "bottom"], optional | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. just | ||
If not provided, *loc* is used. | ||
offset : | ||
axes : `mpl_toolkits.axisartist.axislines.Axes` | ||
Returns | ||
------- | ||
`.AxisArtist` | ||
""" | ||
if axes is None: | ||
_api.warn_external( | ||
"'new_fixed_axis' explicitly requires the axes keyword.") | ||
@@ -325,6 +348,20 @@ def new_fixed_axis( | ||
offset=offset, axis_direction=axis_direction) | ||
def new_floating_axis(self, nth_coord, value, axis_direction="bottom", axes=None): | ||
""" | ||
Parameters | ||
---------- | ||
nth_coord : {0, 1} | ||
Along which coordinate the value varies in 2D. 0: x-axis, 1: y-axis. | ||
value : | ||
axis_direction : ["left", "right", "top", "bottom"], default: "bottom" | ||
axes : `mpl_toolkits.axisartist.axislines.Axes` | ||
Returns | ||
------- | ||
`.AxisArtist` | ||
""" | ||
if axes is None: | ||
_api.warn_external( | ||
"'new_floating_axis' explicitly requires the axes keyword.") | ||
@@ -387,6 +424,14 @@ def __init__(self, *args, grid_helper=None, **kwargs): | ||
self.toggle_axisline(True) | ||
def toggle_axisline(self, b=None): | ||
""" | ||
Enable/disable or toggle Axis etc. | ||
Parameters | ||
---------- | ||
b : bool, optional | ||
Enable if True, disable if False, toggle if not provided. | ||
""" | ||
if b is None: | ||
b = not self._axisline_on | ||
if b: | ||
@@ -462,9 +507,35 @@ def get_children(self): | ||
return children | ||
def new_fixed_axis(self, loc, offset=None): | ||
""" | ||
Create a new fixed axis in this Axes. | ||
Parameters | ||
---------- | ||
loc : ["left", "right", "top", "bottom"] | ||
offset : optional | ||
Returns | ||
------- | ||
`.AxisArtist` | ||
""" | ||
return self.get_grid_helper().new_fixed_axis(loc, offset=offset, axes=self) | ||
def new_floating_axis(self, nth_coord, value, axis_direction="bottom"): | ||
""" | ||
Create a new floating axis in this Axes. | ||
Parameters | ||
---------- | ||
nth_coord : {0, 1} | ||
Along which coordinate the value varies in 2D. 0: x-axis, 1: y-axis. | ||
value : | ||
axis_direction : ["left", "right", "top", "bottom"], default: "bottom" | ||
Returns | ||
------- | ||
`.AxisArtist` | ||
""" | ||
return self.get_grid_helper().new_floating_axis( | ||
nth_coord, value, axis_direction=axis_direction, axes=self) | ||