From: Michael K. <kau...@or...> - 2016-01-20 18:26:13
|
Hi Gurus: I'm having a serious problem with MultiCursor and autoscaling... If I do the code below with both MultiCursor instantiations commented out, then all plots are xscaled to [50,55] and yscaled to each plot's appropriate ylimits. If I uncomment the top MultiCursor instantiation, then both the xlimits and ylimits are screwed up: xlim=[0,60] and ylim is all over the place, certainly not autoscaled tight. If I uncomment the bottom MultiCursor instantiation, then the xlimit appears to be scaled correctly, [50,55], but two of the four plots (lower left and upper right) are not autoscaled in y. How to I instantiate MultiCursor to get the normal and expected autoscaling behavior? Not that it should matter, but I'm using here Tk and Python3 with MPL 1.5dev1 (91ca2a3724ae91d28d97) Thanks for any help, M ============= from matplotlib import pyplot as pl from matplotlib.widgets import MultiCursor from matplotlib import gridspec import numpy as np if __name__ == "__main__": fig = pl.gcf() gs = gridspec.GridSpec(2,2) ax = None for g in gs: ax = pl.subplot(g, sharex=ax) #multi = MultiCursor(fig.canvas, tuple(fig.axes), # useblit=True, horizOn=True, color='k', lw=1) x = np.arange(50,55,0.01) y1 = np.sin(x) y2 = np.cos(x) + 4 y3 = 0.2*np.cos(x) - 4 y4 = np.cos(2*x) - 1 for ax,y in zip(fig.axes, [y1,y2,y3,y4]): ax.plot(x,y) for ax in fig.axes: ax.grid() #multi = MultiCursor(fig.canvas, tuple(fig.axes), # useblit=True, horizOn=True, color='k', lw=1) pl.draw() pl.show() |