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

Skip to content

Commit 0919861

Browse files
committed
Starting
1 parent 41bb1d0 commit 0919861

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,44 @@ def indicate_inset_zoom(self, inset_ax, **kwargs):
639639

640640
return rectpatch, connects
641641

642+
def secondary_xaxis(self, loc, conversion, *, **kwargs):
643+
"""
644+
Add a second x-axis to this axes.
645+
646+
For example if we want to have a second scale for the data plotted on
647+
the xaxis.
648+
649+
Parameters
650+
----------
651+
loc : string or scalar
652+
The position to put the secondary axis. Strings can be 'top' or
653+
'bottom', scalar can be a float indicating the relative position
654+
on the axes to put the new axes (0 being the bottom, and 1.0 being
655+
the top.)
656+
657+
conversion : tuple of floats or function
658+
conversion between the parent xaxis values and the secondary xaxis
659+
values. If a tuple of floats, the floats are polynomial
660+
co-efficients, with the first entry the highest exponent's
661+
co-efficient (i.e. [2, 3, 1] is the same as
662+
``xnew = 2 x**2 + 3 * x + 1``). If a function is specified it
663+
should accept a float as input and return a float as the
664+
result.
665+
666+
Other Parameters
667+
----------------
668+
**kwargs : `~matplotlib.axes.Axes` properties.
669+
Other miscellaneous axes parameters.
670+
671+
Returns
672+
-------
673+
ax : `~matplotlib.axes.Axes` (??)
674+
675+
"""
676+
secondary_ax = Secondary_Xaxis(self, loc, conversion, **kwargs)
677+
self.add_child_axes(secondary_ax)
678+
679+
642680
def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
643681
"""
644682
Add text to the axes.

0 commit comments

Comments
 (0)