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

Skip to content

Improve docs on Axes scales #12720

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 42 additions & 28 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3248,9 +3248,14 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False,
return left, right

def get_xscale(self):
"""
Return the x-axis scale as string.

See Also
--------
set_xscale
"""
return self.xaxis.get_scale()
get_xscale.__doc__ = "Return the xaxis scale string: %s""" % (
", ".join(mscale.get_scale_names()))

def set_xscale(self, value, **kwargs):
"""
Expand All @@ -3259,22 +3264,24 @@ def set_xscale(self, value, **kwargs):
Parameters
----------
value : {"linear", "log", "symlog", "logit", ...}
scaling strategy to apply
The axis scale type to apply.

Notes
-----
Different kwargs are accepted, depending on the scale. See
the `~matplotlib.scale` module for more information.

See also
--------
matplotlib.scale.LinearScale : linear transform
**kwargs
Different keyword arguments are accepted, depending on the scale.
See the respective class keyword arguments:

matplotlib.scale.LogTransform : log transform
- `matplotlib.scale.LinearScale`
- `matplotlib.scale.LogScale`
- `matplotlib.scale.SymmetricalLogScale`
- `matplotlib.scale.LogitScale`

matplotlib.scale.SymmetricalLogTransform : symlog transform

matplotlib.scale.LogisticTransform : logit transform
Notes
-----
By default, Matplotlib supports the above mentioned scales.
Additionally, custom scales may be registered using
`matplotlib.scale.register_scale`. These scales can then also
be used here.
"""
g = self.get_shared_x_axes()
for ax in g.get_siblings(self):
Expand Down Expand Up @@ -3630,9 +3637,14 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
return bottom, top

def get_yscale(self):
"""
Return the x-axis scale as string.

See Also
--------
set_yscale
"""
return self.yaxis.get_scale()
get_yscale.__doc__ = "Return the yaxis scale string: %s""" % (
", ".join(mscale.get_scale_names()))

def set_yscale(self, value, **kwargs):
"""
Expand All @@ -3641,22 +3653,24 @@ def set_yscale(self, value, **kwargs):
Parameters
----------
value : {"linear", "log", "symlog", "logit", ...}
scaling strategy to apply
The axis scale type to apply.

Notes
-----
Different kwargs are accepted, depending on the scale. See
the `~matplotlib.scale` module for more information.

See also
--------
matplotlib.scale.LinearScale : linear transform
**kwargs
Different keyword arguments are accepted, depending on the scale.
See the respective class keyword arguments:

matplotlib.scale.LogTransform : log transform
- `matplotlib.scale.LinearScale`
- `matplotlib.scale.LogScale`
- `matplotlib.scale.SymmetricalLogScale`
- `matplotlib.scale.LogitScale`

matplotlib.scale.SymmetricalLogTransform : symlog transform

matplotlib.scale.LogisticTransform : logit transform
Notes
-----
By default, Matplotlib supports the above mentioned scales.
Additionally, custom scales may be registered using
`matplotlib.scale.register_scale`. These scales can then also
be used here.
"""
g = self.get_shared_y_axes()
for ax in g.get_siblings(self):
Expand Down