Skip to content
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
13 changes: 12 additions & 1 deletion examples/subplots_axes_and_figures/secondary_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def rad2deg(x):
# Here is the case of converting from wavenumber to wavelength in a
# log-log scale.
#
# .. note ::
# .. note::
#
# In this case, the xscale of the parent is logarithmic, so the child is
# made logarithmic as well.
Expand Down Expand Up @@ -79,6 +79,17 @@ def one_over(x):
# the data, and is derived empirically. In that case we can set the
# forward and inverse transforms functions to be linear interpolations from the
# one data set to the other.
#
# .. note::
#
# In order to properly handle the data margins, the mapping functions
# (``forward`` and ``inverse`` in this example) need to be defined beyond the
# nominal plot limits.
#
# In the specific case of the numpy linear interpolation, `numpy.interp`,
# this condition can be arbitrarily enforced by providing optional kwargs
# *left*, *right* such that values outside the data range are mapped
# well outside the plot limits.

fig, ax = plt.subplots(constrained_layout=True)
xdata = np.arange(1, 11, 0.4)
Expand Down