SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Alan G. <ala...@gm...> - 2012年06月05日 02:27:16
I've come across a problem (possibly a bug in cleanup_path) after
plotting a line containing nan's and then scaling the axes so that the
line is clipped by the axes.
Instead of a gap at the position of the nan value, two extra segments
appear - back to the start and then onto the next-plus-one valid
point. It's quite dependent on exactly how the line is clipped, and
by interactively zooming the plot the issue can be made to disappear
and reappear.
e.g.
##############################
import matplotlib
matplotlib.use('pdf') #pdf or ps or agg (incl. inside gui) reproduce
the issue, cairo works as expected
import matplotlib.pyplot as plt
import numpy as np
f = plt.figure()
ax = f.add_subplot(111)
ax.plot([30.,50.,900.,449.0,np.nan,50,60,100])
ax.set_ylim([0,400]) #default plot limits work fine
f.savefig('test')
##############################
This is with the Ubuntu 12.04 version of matplotlib (on x86_64);
v1.1.1rc. Version 1.0.1 (also via Ubuntu) was ok.
For the pdf backend, at least, the problem seems to appear in the call to
cleanup_path at line 247 of path.py (in iter_segments):
vertices, codes = cleanup_path(self, transform, remove_nans, clip,
 snap, stroke_width, simplify, curves)
Before the call, the path looks ok, but after the call to
cleanup_path, vertices is a bit of a mess (corresponding 'code' in
brackets):
 array([[ 72. , 69.12 ], (moveto)
 [ 135.77142857, 86.4 ], (lineto)
 [ 165.86834734, 433. ], (lineto)
 [ 263.00922817, 433. ], (moveto)
 [ 263.31428571, 431.136 ], (lineto)
 [ 72. , 69.12 ], (lineto) <--- (should be a gap?)
 [ 454.62857143, 95.04 ], (lineto)
 [ 518.4 , 129.6 ], (lineto)
 [ 518.4 , 129.6 ]]) (stop)
I can work around the problem by setting the backend to 'cairo' or by adding
 clip = None
near the top of iter_segments (line 235 of path.py)
HTH.
From: Jouni K. S. <jk...@ik...> - 2012年06月09日 19:24:29
Alan Griffiths <ala...@gm...> writes:
> I've come across a problem (possibly a bug in cleanup_path) after
> plotting a line containing nan's and then scaling the axes so that the
> line is clipped by the axes.
>
> Instead of a gap at the position of the nan value, two extra segments
> appear - back to the start and then onto the next-plus-one valid
> point. 
This sounds a lot like
https://github.com/matplotlib/matplotlib/issues/804
There was a bug in the fix for that, which was fixed in 
https://github.com/matplotlib/matplotlib/pull/873
I think at least the latter fix was merged later than the release
candidate was announced. You might want to try a later version.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
On Sun, Jun 10, 2012 at 5:24 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> Alan Griffiths <ala...@gm...> writes:
>
>> I've come across a problem (possibly a bug in cleanup_path) after
>> plotting a line containing nan's and then scaling the axes so that the
>> line is clipped by the axes.
>>
>> Instead of a gap at the position of the nan value, two extra segments
>> appear - back to the start and then onto the next-plus-one valid
>> point.
>
> This sounds a lot like
>
> https://github.com/matplotlib/matplotlib/issues/804
>
Thanks, yes it's fixed in 1.1.1rc2
From: Julian T. <jta...@go...> - 2012年06月26日 18:01:45
Attachments: signature.asc
Please also report these issues to Ubuntu.
If its significant enough it we can fix this issue in the package. But
we can't fix what we don't know about.
The option of updating the rc to the future final 1.1.1 is also open if
the bug fixed are worth it.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /