plot_2nd_xaxis
- mdtools.plot.plot_2nd_xaxis(ax, x, y, xmin=None, xmax=None, xlabel='$x2$', legend_loc='best', **kwargs)[source]
Plot data to a second x-axis.
Deprecated since version 0.0.0.dev2: Use
matplotlib.axes.Axes.twiny()
,matplotlib.axes.Axes.plot()
,matplotlib.axes.Axes.set()
andmatplotlib.axes.Axes.legend()
directly.Create a twin
matplotlib.axes.Axes
of an existingmatplotlib.axes.Axes
sharing the same y-axis usingmatplotlib.axes.Axes.twiny()
and plot data to the twinAxes
usingmatplotlib.axes.Axes.plot()
.- Parameters:
ax (
matplotlib.axes.Axes
) – Thematplotlib.axes.Axes
from which to create a twin that shares the same y-axis. Data are plotted to the created twin axes.x (
array_like
) – One dimensional array containing the x data.y (
array_like
) – Array of the same shape as x containing the y data.xmin (
scalar
, optional) – Left limit for plotting on the secondary x-axis. The left limit may be greater than the right limit, in which case the tick values will show up in decreasing order. Default isNone
, which means set the limit automatically.xmax (
scalar
, optional) – Right limit for plotting on the secondary x-axis.xlabel (
str
, optional) – Label for the secondary x-axis.legend_loc (
int
orstr
, optional) – Position of the legend. Seematplotlib.pyplot.legend()
for possible arguments.kwargs (
dict
, optional) – Keyword arguments to pass tomatplotlib.axes.Axes.plot()
. See there for possible keyword arguments.
- Returns:
img (
list
) – A list ofmatplotlib.lines.Line2D
objects representing the plotted data.ax2 (
matplotlib.axes.Axes
) – The twin axis.