[Matplotlib-users] bug? line misses points with negative coordinates

CC to matplotlib-devel & matplotlib-users

2010/9/3 Tony S Yu <tsyu80@...149...>:

Hello,

While using sage [1], I got problems drawing a line: for some reason,
the points with negative coordinates are not plotted (or are plotted
on top of others due to an offset problem and thus I cannot see them).
I can only reproduce the bug with specific data sets.

[1] www.sagemath.org

I think I could track down the bug to matplotlib, which sage uses to
render 2d plots.

I included a sage script which generates the data set (in a pickle
file), and a python script which draws the faulty line.

Usage is :

sage generate\_data\.sage python test_mpl.py

I also included the pickled data, thus you don't need sage at all.
I use matplotlib 1.0.0 for python 2.6 on mac os (as provided by macport).

Could somebody here confirm the problem, and give me a hint about what
is going on?

I can confirm the issue.

Great, thank you. I filed a bug:
https://sourceforge.net/tracker/?func=detail&aid=3058804&group_id=80706&atid=560720

···

On Sep 3, 2010, at 4:33 AM, Sébastien Barthélemy wrote:

This appears to be a drawing bug: when I pan the drawing so that the negative data touches the edge of the axes frame, the rest of the line is drawn. So the line object is being created, but for some reason it's not being drawn correctly.

The bug is really finicky: if I plot starting from the 3rd value of your data (i.e. slice xdata, ydata with [2:]), the line is drawn completely. The strange thing is that the first 100 or so data points defines the exact same point, so there's noting special about those first two points. (but this overlaying of data may be related to the bug)

I've reproduced the issue on TkAgg, Qt4Agg, and MacOSX backends, so maybe the bug is in backend_bases. (Note: unlike Agg backends, MacOSX backend doesn't show line even after panning the plot)

I don't really know how to debug drawing errors like this; so this is as far as can get.

I'm not sure if I should respond to this email or the bug report, but since I made the claim here, I'll correct myself here: The bug is not in the drawing code as I had suggested.

The bug is related to path simplification. If you turn off path simplification (e.g. plt.rc('path', simplify=False), the line is drawn in its entirety. This also explains why the bug disappeared when I trimmed the first two points: path simplification is triggered from data sets with atleast 128 points (your data has 129, so trimming two points turned off path simplification).

I just wanted to correct my earlier comments.

-T

···

On Sep 3, 2010, at 10:23 AM, Sébastien Barthélemy wrote:

CC to matplotlib-devel & matplotlib-users

2010/9/3 Tony S Yu <tsyu80@...149...>:

On Sep 3, 2010, at 4:33 AM, Sébastien Barthélemy wrote:

Hello,

While using sage [1], I got problems drawing a line: for some reason,
the points with negative coordinates are not plotted (or are plotted
on top of others due to an offset problem and thus I cannot see them).
I can only reproduce the bug with specific data sets.

[1] www.sagemath.org

I think I could track down the bug to matplotlib, which sage uses to
render 2d plots.

I included a sage script which generates the data set (in a pickle
file), and a python script which draws the faulty line.

Usage is :

sage generate\_data\.sage python test_mpl.py

I also included the pickled data, thus you don't need sage at all.
I use matplotlib 1.0.0 for python 2.6 on mac os (as provided by macport).

Could somebody here confirm the problem, and give me a hint about what
is going on?

I can confirm the issue.

Great, thank you. I filed a bug:
https://sourceforge.net/tracker/?func=detail&aid=3058804&group_id=80706&atid=560720

This appears to be a drawing bug: when I pan the drawing so that the negative data touches the edge of the axes frame, the rest of the line is drawn. So the line object is being created, but for some reason it's not being drawn correctly.

The bug is really finicky: if I plot starting from the 3rd value of your data (i.e. slice xdata, ydata with [2:]), the line is drawn completely. The strange thing is that the first 100 or so data points defines the exact same point, so there's noting special about those first two points. (but this overlaying of data may be related to the bug)

I've reproduced the issue on TkAgg, Qt4Agg, and MacOSX backends, so maybe the bug is in backend_bases. (Note: unlike Agg backends, MacOSX backend doesn't show line even after panning the plot)

I don't really know how to debug drawing errors like this; so this is as far as can get.

CC to matplotlib-devel& matplotlib-users

2010/9/3 Tony S Yu<tsyu80@...149...>:

Hello,

While using sage [1], I got problems drawing a line: for some reason,
the points with negative coordinates are not plotted (or are plotted
on top of others due to an offset problem and thus I cannot see them).
I can only reproduce the bug with specific data sets.

[1] www.sagemath.org

I think I could track down the bug to matplotlib, which sage uses to
render 2d plots.

I included a sage script which generates the data set (in a pickle
file), and a python script which draws the faulty line.

Usage is :

sage generate\_data\.sage python test_mpl.py

I also included the pickled data, thus you don't need sage at all.
I use matplotlib 1.0.0 for python 2.6 on mac os (as provided by macport).

Could somebody here confirm the problem, and give me a hint about what
is going on?

I can confirm the issue.

Great, thank you. I filed a bug:
https://sourceforge.net/tracker/?func=detail&aid=3058804&group_id=80706&atid=560720

This appears to be a drawing bug: when I pan the drawing so that the negative data touches the edge of the axes frame, the rest of the line is drawn. So the line object is being created, but for some reason it's not being drawn correctly.

The bug is really finicky: if I plot starting from the 3rd value of your data (i.e. slice xdata, ydata with [2:]), the line is drawn completely. The strange thing is that the first 100 or so data points defines the exact same point, so there's noting special about those first two points. (but this overlaying of data may be related to the bug)

I've reproduced the issue on TkAgg, Qt4Agg, and MacOSX backends, so maybe the bug is in backend_bases. (Note: unlike Agg backends, MacOSX backend doesn't show line even after panning the plot)

I don't really know how to debug drawing errors like this; so this is as far as can get.

I'm not sure if I should respond to this email or the bug report, but since I made the claim here, I'll correct myself here: The bug is not in the drawing code as I had suggested.

The bug is related to path simplification. If you turn off path simplification (e.g. plt.rc('path', simplify=False), the line is drawn in its entirety. This also explains why the bug disappeared when I trimmed the first two points: path simplification is triggered from data sets with atleast 128 points (your data has 129, so trimming two points turned off path simplification).

I just wanted to correct my earlier comments.

Tony,

Thanks--it's in a comment added to the bug report. Also, this is the same problem as reported earlier by Jens Nie. The bug is in path_converters.h. I think I found part of it, but a real solution may require more than a changed line or two, and I can't spend more time on it at the moment. Mike D. could figure it out quickly, but I think he is not available right now.

Eric

···

On 09/03/2010 09:14 AM, Tony S Yu wrote:

On Sep 3, 2010, at 10:23 AM, Sébastien Barthélemy wrote:

On Sep 3, 2010, at 4:33 AM, Sébastien Barthélemy wrote:

-T

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

I believe I have a fix in r8691 (both branch and trunk).

Cheers,
Mike

···

On 09/03/2010 03:31 PM, Eric Firing wrote:

On 09/03/2010 09:14 AM, Tony S Yu wrote:
   

On Sep 3, 2010, at 10:23 AM, S�bastien Barth�lemy wrote:

CC to matplotlib-devel& matplotlib-users

2010/9/3 Tony S Yu<tsyu80@...149...>:
       

On Sep 3, 2010, at 4:33 AM, S�bastien Barth�lemy wrote:

Hello,

While using sage [1], I got problems drawing a line: for some reason,
the points with negative coordinates are not plotted (or are plotted
on top of others due to an offset problem and thus I cannot see them).
I can only reproduce the bug with specific data sets.

[1] www.sagemath.org

I think I could track down the bug to matplotlib, which sage uses to
render 2d plots.

I included a sage script which generates the data set (in a pickle
file), and a python script which draws the faulty line.

Usage is :

sage generate\_data\.sage python test_mpl.py

I also included the pickled data, thus you don't need sage at all.
I use matplotlib 1.0.0 for python 2.6 on mac os (as provided by macport).

Could somebody here confirm the problem, and give me a hint about what
is going on?
           

I can confirm the issue.
         

Great, thank you. I filed a bug:
https://sourceforge.net/tracker/?func=detail&aid=3058804&group_id=80706&atid=560720

This appears to be a drawing bug: when I pan the drawing so that the negative data touches the edge of the axes frame, the rest of the line is drawn. So the line object is being created, but for some reason it's not being drawn correctly.

The bug is really finicky: if I plot starting from the 3rd value of your data (i.e. slice xdata, ydata with [2:]), the line is drawn completely. The strange thing is that the first 100 or so data points defines the exact same point, so there's noting special about those first two points. (but this overlaying of data may be related to the bug)

I've reproduced the issue on TkAgg, Qt4Agg, and MacOSX backends, so maybe the bug is in backend_bases. (Note: unlike Agg backends, MacOSX backend doesn't show line even after panning the plot)

I don't really know how to debug drawing errors like this; so this is as far as can get.
         

I'm not sure if I should respond to this email or the bug report, but since I made the claim here, I'll correct myself here: The bug is not in the drawing code as I had suggested.

The bug is related to path simplification. If you turn off path simplification (e.g. plt.rc('path', simplify=False), the line is drawn in its entirety. This also explains why the bug disappeared when I trimmed the first two points: path simplification is triggered from data sets with atleast 128 points (your data has 129, so trimming two points turned off path simplification).

I just wanted to correct my earlier comments.

Tony,

Thanks--it's in a comment added to the bug report. Also, this is the
same problem as reported earlier by Jens Nie. The bug is in
path_converters.h. I think I found part of it, but a real solution may
require more than a changed line or two, and I can't spend more time on
it at the moment. Mike D. could figure it out quickly, but I think he
is not available right now.

Eric

-T

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
     
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
   
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA