Incomplete rendering of line plot

I've run into a case where the rendering in a line plot is incomplete
and some lines are not drawn at all. Basically I have a dataset (see
below) where I know two points go to a value of zero. When I plot
the points and do interactive pan/zoom sometimes the line going down
to zero is there and sometimes not. After a bunch of playing around
trying to reduce the problem to a minimum the script below is what I
got. If I tried to make the 'y' array much smaller then the problem
went away. I played with antialias and interactive settings with no
benefit. Changing the window size can also produce the same effect
I'm describing. Finally, when I use savefig to save in various
formats the results varied, perhaps just a side-effect of the size of
the saved figure.

I'm using Matplotlib 0.99.1.1 built from source with the TkAgg backend
on CentOS-5 with python 2.6. This same problem was also evident using
GtkAgg and MacOSX backends so I don't think the details of my build
are relevant (but I can supply if needed).

Thanks, Tom

import numpy
import matplotlib.pyplot as plt

y = numpy.array([
4., 2., 2., 3., 3., 2., 2., 6., 6., 5., 5., 4., 4.,
7., 7., 2., 2., 4., 4., 2., 2., 2., 2., 4., 4., 4.,
4., 4., 4., 7., 7., 3., 3., 5., 5., 4., 4., 5., 5.,
4., 4., 7., 7., 6., 6., 2., 2., 2., 2., 5., 5., 4.,
4., 4., 4., 6., 6., 3., 3., 4., 4., 3., 3., 2., 2.,
3., 3., 4., 4., 4., 4., 4., 4., 6., 6., 5., 5., 4.,
4., 7., 7., 3., 3., 4., 4., 4., 4., 5., 5., 4., 4.,
7., 7., 3., 3., 4., 4., 4., 4., 6., 6., 4., 4., 4.,
4., 4., 4., 2., 2., 5., 5., 6., 6., 3., 3., 5., 5.,
4., 4., 0., 0., 5., 5., 1., 1., 4., 4., 5., 5., 4.])

plt.figure()
plt.plot(y)

plt.figure()
plt.plot(y)
plt.xlim(-7200, 6500)
# Does it go down to 0 now?

Tom Aldcroft wrote:

I've run into a case where the rendering in a line plot is incomplete
and some lines are not drawn at all. Basically I have a dataset (see
below) where I know two points go to a value of zero. When I plot
the points and do interactive pan/zoom sometimes the line going down
to zero is there and sometimes not. After a bunch of playing around
trying to reduce the problem to a minimum the script below is what I
got. If I tried to make the 'y' array much smaller then the problem
went away. I played with antialias and interactive settings with no
benefit. Changing the window size can also produce the same effect
I'm describing. Finally, when I use savefig to save in various
formats the results varied, perhaps just a side-effect of the size of
the saved figure.

I'm using Matplotlib 0.99.1.1 built from source with the TkAgg backend
on CentOS-5 with python 2.6. This same problem was also evident using
GtkAgg and MacOSX backends so I don't think the details of my build
are relevant (but I can supply if needed).

Thanks, Tom

It works for me in svn, so I am pretty sure you have run into the infamous path simplification bug. If you are building from source anyway, then just build from svn. Alternatively, you can put

path.simplify : False

in your matplotlibrc file to disable path simplification.

Eric

ยทยทยท

import numpy
import matplotlib.pyplot as plt

y = numpy.array([
4., 2., 2., 3., 3., 2., 2., 6., 6., 5., 5., 4., 4.,
7., 7., 2., 2., 4., 4., 2., 2., 2., 2., 4., 4., 4.,
4., 4., 4., 7., 7., 3., 3., 5., 5., 4., 4., 5., 5.,
4., 4., 7., 7., 6., 6., 2., 2., 2., 2., 5., 5., 4.,
4., 4., 4., 6., 6., 3., 3., 4., 4., 3., 3., 2., 2.,
3., 3., 4., 4., 4., 4., 4., 4., 6., 6., 5., 5., 4.,
4., 7., 7., 3., 3., 4., 4., 4., 4., 5., 5., 4., 4.,
7., 7., 3., 3., 4., 4., 4., 4., 6., 6., 4., 4., 4.,
4., 4., 4., 2., 2., 5., 5., 6., 6., 3., 3., 5., 5.,
4., 4., 0., 0., 5., 5., 1., 1., 4., 4., 5., 5., 4.])

plt.figure()
plt.plot(y)

plt.figure()
plt.plot(y)
plt.xlim(-7200, 6500)
# Does it go down to 0 now?

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users