MultiCursor messes with xlim and ylim autoscaling

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

multicursor_limtest.py (806 Bytes)

···

=============

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

HI all,

I wanted to help (for a change) but running the script on mac (with the multi cursor code commented out), I got the following error. If anyone can figure out why !

File "/Users/j35/anaconda/lib/python3.4/site-packages/matplotlib/widgets.py", line 1046, in clear
    self.canvas.copy_from_bbox(self.canvas.figure.bbox))
AttributeError: 'FigureCanvasMac' object has no attribute ‘copy_from_bbox'

I’m using python 3.4 and matplotlib 1.4.3

Thanks

Jean

···

On Jan 20, 2016, at 1:26 PM, Michael Kaufman <kaufmanmc@...4558...> wrote:

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()
<multicursor_limtest.py>------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options

Add “blit=False” in the instantiation for multicursor to get around the copy_from_bbox issue.

I wonder if the use of fig.axes might be a problem?

···

On Jan 20, 2016 2:27 PM, “Bilheux, Jean-Christophe” <bilheuxjm@…4705…> wrote:

HI all,

I wanted to help (for a change) but running the script on mac (with the multi cursor code commented out), I got the following error. If anyone can figure out why !

File “/Users/j35/anaconda/lib/python3.4/site-packages/matplotlib/widgets.py”, line 1046, in clear

self.canvas.copy_from_bbox(self.canvas.figure.bbox))

AttributeError: ‘FigureCanvasMac’ object has no attribute ‘copy_from_bbox’

I’m using python 3.4 and matplotlib 1.4.3

Thanks

Jean

On Jan 20, 2016, at 1:26 PM, Michael Kaufman <kaufmanmc@…4558…> wrote:

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

<multicursor_limtest.py>------------------------------------------------------------------------------

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


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