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 <tsy...@gmail.com>:
>> 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.

-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
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to