Pan and zoom tool makes markers disappear

Hi,

I found a minor bug. Clicking with the pan and zoom tool on a plot with markers and the markevery option makes the markers disappear.

OS: Ubuntu
Matplotlib svn revision 6861
Backend: GTKAgg. Didn't test any others.

Example script:

···

------------------------------------------------
import matplotlib.pyplot as pl
import numpy as np

pl.plot(np.arange(100.0),np.arange(100.0),marker="+",markevery=5)
pl.show()
------------------------------------------------

Just left click with the pan and zoom tool, or otherwise use the pan and zoom tool and the markers will disappear.

Regards,
Jo�o Silva

Thanks for the report. I'm not actually able to reproduce this here -- though I suspect this could be related to the recent path simplification changes.

Taking a stab in the dark -- have you tried removing the build directory and rebuilding? distutils doesn't do dependency-tracking, so if header files change it often doesn't rebuild enough.

Mike

Jo�o Lu�s Silva wrote:

···

Hi,

I found a minor bug. Clicking with the pan and zoom tool on a plot with markers and the markevery option makes the markers disappear.

OS: Ubuntu
Matplotlib svn revision 6861
Backend: GTKAgg. Didn't test any others.

Example script:

------------------------------------------------
import matplotlib.pyplot as pl
import numpy as np

pl.plot(np.arange(100.0),np.arange(100.0),marker="+",markevery=5)
pl.show()
------------------------------------------------

Just left click with the pan and zoom tool, or otherwise use the pan and zoom tool and the markers will disappear.

Regards,
Jo�o Silva

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

Thanks for the report. I'm not actually able to reproduce this here -- though I suspect this could be related to the recent path simplification changes.

Taking a stab in the dark -- have you tried removing the build directory and rebuilding? distutils doesn't do dependency-tracking, so if header files change it often doesn't rebuild enough.

I didn't remove the build subdirectory, but always did a python setup.py clean / remove all mpl stuff from site-packages. Anyway, this time I did remove the build subdirectory but the problem remains. The bug seems to be backend independent and is there since the first support of markevery, on revision 6631. The problem seems to be that the function draw() of Line2D keeps removing the n-th marker for markevery=n, even if it has already done so. I tried to reproduce this on Windows, but the latest release (0.98.5) doesn't support markevery.

My 32-bit Ubuntu installation is pretty standard. I could reproduce this on two different computers with the same Ubuntu 8.10 and mpl svn.

If I run this script, select the pan/zoom tool and just click on the plot (not dragging, just left clicking in place) each click will remove every second marker until there are no markers left.

···

------------------------------------------
import matplotlib.pyplot as pl
import numpy as np

pl.plot(np.arange(100.0),np.arange(100.0),marker="+",markevery=2)
pl.show()
------------------------------------------

Best regards,
Jo�o Silva

Thanks for narrowing this down. I have (hopefully) fixed this in r6864.

Cheers,
Mike

Jo�o Lu�s Silva wrote:

···

Michael Droettboom wrote:

Thanks for the report. I'm not actually able to reproduce this here -- though I suspect this could be related to the recent path simplification changes.

Taking a stab in the dark -- have you tried removing the build directory and rebuilding? distutils doesn't do dependency-tracking, so if header files change it often doesn't rebuild enough.

I didn't remove the build subdirectory, but always did a python setup.py clean / remove all mpl stuff from site-packages. Anyway, this time I did remove the build subdirectory but the problem remains. The bug seems to be backend independent and is there since the first support of markevery, on revision 6631. The problem seems to be that the function draw() of Line2D keeps removing the n-th marker for markevery=n, even if it has already done so. I tried to reproduce this on Windows, but the latest release (0.98.5) doesn't support markevery.

My 32-bit Ubuntu installation is pretty standard. I could reproduce this on two different computers with the same Ubuntu 8.10 and mpl svn.

If I run this script, select the pan/zoom tool and just click on the plot (not dragging, just left clicking in place) each click will remove every second marker until there are no markers left.

------------------------------------------
import matplotlib.pyplot as pl
import numpy as np

pl.plot(np.arange(100.0),np.arange(100.0),marker="+",markevery=2)
pl.show()
------------------------------------------

Best regards,
Jo�o Silva

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

Thanks for narrowing this down. I have (hopefully) fixed this in r6864.

It did fix my previous examples. However it broke the other form of markevery, a 2-int tuple. From the set_markevery docs:

         Set the markevery property to subsample the plot when using
         markers. Eg if ``markevery=5``, every 5-th marker will be
         plotted. *every* can be

         None
             Every point will be plotted

         an integer N
             Every N-th marker will be plotted starting with marker 0

         A length-2 tuple of integers
             every=(start, N) will start at point start and plot every N-th marker

         ACCEPTS: None | integer | (startind, stride)

I don't know if the tuple version ever worked, for I couldn't figure it out, but if it is to remain it now breaks mpl with:

[...]
   File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1658, in draw
     a.draw(renderer)
   File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 521, in draw
     markerFunc(renderer, gc, subsampled, affine.frozen())
UnboundLocalError: local variable 'subsampled' referenced before assignment

Example script:

···

----------------------------------
import matplotlib.pyplot as pl
import numpy as np

pl.plot(np.arange(100.0),np.arange(100.0),marker="+",markevery=(50,5))
pl.show()
----------------------------------

I don't know what is the purpose and how to make the tuple version work. Maybe John can shed some light into this?

Jo�o Silva

There seems to have been an indentation error there.

Please update and try again now.

Thanks,
Mike

Jo�o Lu�s Silva wrote:

···

Michael Droettboom wrote:

Thanks for narrowing this down. I have (hopefully) fixed this in r6864.

It did fix my previous examples. However it broke the other form of markevery, a 2-int tuple. From the set_markevery docs:

        Set the markevery property to subsample the plot when using
        markers. Eg if ``markevery=5``, every 5-th marker will be
        plotted. *every* can be

        None
            Every point will be plotted

        an integer N
            Every N-th marker will be plotted starting with marker 0

        A length-2 tuple of integers
            every=(start, N) will start at point start and plot every N-th marker

        ACCEPTS: None | integer | (startind, stride)

I don't know if the tuple version ever worked, for I couldn't figure it out, but if it is to remain it now breaks mpl with:

[...]
  File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1658, in draw
    a.draw(renderer)
  File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 521, in draw
    markerFunc(renderer, gc, subsampled, affine.frozen())
UnboundLocalError: local variable 'subsampled' referenced before assignment

Example script:
----------------------------------
import matplotlib.pyplot as pl
import numpy as np

pl.plot(np.arange(100.0),np.arange(100.0),marker="+",markevery=(50,5))
pl.show()
----------------------------------

I don't know what is the purpose and how to make the tuple version work. Maybe John can shed some light into this?

Jo�o Silva

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

There seems to have been an indentation error there.

Please update and try again now.

All seems to be fine now, thanks.

Jo�o Silva