Commit b69dbe45 authored by ulrich_y's avatar ulrich_y
Browse files

Changed mpl_axes_aligner to new syntax

parent 4593b28c
......@@ -48,7 +48,17 @@ def shiftyaxis(ax, org, pos, expand=False):
ax.set_ylim(bottom, top)
def yaxes(ax1, org1, ax2, org2):
def yaxes(ax1, ax2, y1=1, y2=None):
"""
yaxes(ax1, ax2, y=1) changes the limits of ax1 and ax2 to align the
values of y on both axis.
yaxes(ax1, y1, ax2, y2) changes the limits of the axis ax1 and ax2
such that the value for y1 on ax1 is aligned to the value of y2 on
ax2.
"""
if y2 is None:
y2 = y1
# Get plotting ranges
try:
lim1 = list(ax1.get_ylim())
......@@ -58,8 +68,8 @@ def yaxes(ax1, org1, ax2, org2):
"matplotlib.")
# Calculate the position
pos = _calc_pos(org1, org2, lim1, lim2)
pos = _calc_pos(y1, y2, lim1, lim2)
# Apply the new ranges
shiftyaxis(ax1, org1, pos, True)
shiftyaxis(ax2, org2, pos, True)
shiftyaxis(ax1, y1, pos, True)
shiftyaxis(ax2, y2, pos, True)
......@@ -183,8 +183,8 @@ def twopanel(labelx="",
errorband(i, ax=ax2, col=c)
if len(upalign) == 2:
mpl_axes_aligner.yaxes(
axs[0], upalign[0],
ax2, upalign[1]
axs[0], ax2,
upalign[0], upalign[1]
)
if type(labdownleft) == str:
......@@ -206,8 +206,8 @@ def twopanel(labelx="",
errorband(i, ax=ax3, col=c)
if len(downalign) == 2:
mpl_axes_aligner.yaxes(
axs[1], downalign[0],
ax3, downalign[1]
axs[1], ax3,
downalign[0], downalign[1]
)
return fig, axs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment