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()
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)

  import matplotlib
  print(matplotlib.__version__)

  pl.draw()
  pl.show()

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to