GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Second y-axis does not scale correctly when using zoom tool · Issue #9616 · matplotlib/matplotlib Closed as not planned DescriptionHello, import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.set(title="Two y-scales", ylabel="x / m") # right ax: axr = ax.twinx() axr.set_ylabel("x / cm") def track_yax(ax_): """Syncronize second y-axis with first axis. """ y1, y2 = ax.get_ylim() axr.set_ylim(100*y1, y2*100) # axr.figure.canvas.draw() # does not make a difference yr1, yr2 = axr.get_ylim() print(f"Lower: {y1:+.5g} -> {yr1:+.5g}\t Upper: {y2:+.5g} -> {yr2:+.5g}") # automatically update ylim of ax2 when ylim of ax1 changes. ax.callbacks.connect("ylim_changed", track_yax) # Do the plotting: ax.plot([0, 5, 2, 4, 1], 'o-') ax.grid(True) plt.show() Matplotlib version
Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |