How to get all data points plotted/displayed in a line plot

Hi everyone.

I face a problem here, which I can’t seem to handle by myself, so any help is really appreciated.

I would like to do a simple line plot of a huge dataset as an overview to quickly compare success of different measurement scenarios, and it seems that not every datapoint is displayed. I played a little with the lod parameter, both for the creation of
the axis and the plot command. However timing the plot command and the display itself do not show differences. Here are a few lines of code that help to reproduce the problem.

import time

import matplotlib

matplotlib.use(“Qt4Agg”)

import matplotlib.pyplot as plt

import numpy as np

xData=np.linspace(0, 10.0, 1e6)

yData=np.zeros(xData.shape)

xDataDetail=np.linspace(0.0, 2*np.pi, 1000)

yDataDetail=np.exp(-xDataDetail)np.sin(10.0xDataDetail)

yData[100000:100000+len(yDataDetail)]=yDataDetail

fig=plt.figure()

axes=fig.add_subplot(111)

tic=time.time()

axes.plot(xData, yData, “b-”)

toc=time.time()

axes.grid(True)

print “Plotting took %g s.” % (toc-tic)

plt.show()

The code shows how I usually use the matplotlib environment and creates a simple dataset of 1 million zeros with a short non trivial peak within, that is to be plotted as a blue solid line.

You can see what happens, when you vary the width of the displaying window. On my system usually the minimum amplitude varies when resizing the window.

Is there any way to enforce plotting each and every point?

I use matplotlib version 1.0.0 on a 32 Bit windows XP system installed via the windows installer from sf.

A quick check on a opensuse 11.3 linux box showed the same issue. Using the “standard” TK backend instead of Qt4Agg behaves just the same.

Jens

Jens,

Which version of matplotlib are you using? I wonder if this is the path.simplify bug that was fixed for 1.0.

Essentially, there was a bug in some code that caused some points to be skipped in the process of displaying images that had datapoints that were closer together than could be resolved. I suspect this is what is happening here, because everything looks fine on my latest build.

Ben Root

···

On Tue, Aug 31, 2010 at 6:08 AM, Jens Nie <JNie@…3255…> wrote:

Hi everyone.

I face a problem here, which I can’t seem to handle by myself, so any help is really appreciated.

I would like to do a simple line plot of a huge dataset as an overview to quickly compare success of different measurement scenarios, and it seems that not every datapoint is displayed. I played a little with the lod parameter, both for the creation of
the axis and the plot command. However timing the plot command and the display itself do not show differences. Here are a few lines of code that help to reproduce the problem.

import time

import matplotlib

matplotlib.use(“Qt4Agg”)

import matplotlib.pyplot as plt

import numpy as np

xData=np.linspace(0, 10.0, 1e6)

yData=np.zeros(xData.shape)

xDataDetail=np.linspace(0.0, 2*np.pi, 1000)

yDataDetail=np.exp(-xDataDetail)np.sin(10.0xDataDetail)

yData[100000:100000+len(yDataDetail)]=yDataDetail

fig=plt.figure()

axes=fig.add_subplot(111)

tic=time.time()

axes.plot(xData, yData, “b-”)

toc=time.time()

axes.grid(True)

print “Plotting took %g s.” % (toc-tic)

plt.show()

The code shows how I usually use the matplotlib environment and creates a simple dataset of 1 million zeros with a short non trivial peak within, that is to be plotted as a blue solid line.

You can see what happens, when you vary the width of the displaying window. On my system usually the minimum amplitude varies when resizing the window.

Is there any way to enforce plotting each and every point?

I use matplotlib version 1.0.0 on a 32 Bit windows XP system installed via the windows installer from sf.

A quick check on a opensuse 11.3 linux box showed the same issue. Using the “standard” TK backend instead of Qt4Agg behaves just the same.

Jens

Hi Ben.

It is the version 1.0.0 that i am using, both on Linux and
windows. Is there any newer (development) version that I should try?

Jens

[…]

Is
there any way to enforce plotting each and every point?

I
use matplotlib version 1.0.0 on a 32 Bit windows XP system installed via the
windows installer from sf.

A
quick check on a opensuse 11.3 linux box showed the same issue. Using the
“standard” TK backend instead of Qt4Agg behaves just the same.

Jens

Jens,

Which version of matplotlib are you using? I wonder if this is the
path.simplify bug that was fixed for 1.0.

Essentially, there was a bug in some code that caused some points to be skipped
in the process of displaying images that had datapoints that were closer
together than could be resolved. I suspect this is what is happening
here, because everything looks fine on my latest build.

Ben Root

Hi.

I tested the svn snapshot from yesterday to see if the problem
is there for me in the most recent version. I had to do the check on a linux
box, as that one is the only one I am able to compile on. The svn version
states itself as 1.0.0 also in matplotlib.version which I hope is ok. The “strange”
behavior is still there.

Besides: Where would the correct place be to switch the level of
detail parameter. Once for the axes in add_subplot or for every plot command,
or both?

Jens

···

From: Jens Nie [mailto:JNie@…3256…]
Sent: Wednesday, September 01, 2010 10:03 AM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] How to get all data points
plotted/displayed in a line plot

Hi Ben.

It is the version 1.0.0 that i am using, both on Linux and
windows. Is there any newer (development) version that I should try?

Jens

[…]

Is
there any way to enforce plotting each and every point?

I
use matplotlib version 1.0.0 on a 32 Bit windows XP system installed via the
windows installer from sf.

A
quick check on a opensuse 11.3 linux box showed the same issue. Using the
“standard” TK backend instead of Qt4Agg behaves just the same.

Jens

Jens,

Which version of matplotlib are you using? I wonder if this is the
path.simplify bug that was fixed for 1.0.

Essentially, there was a bug in some code that caused some points to be skipped
in the process of displaying images that had datapoints that were closer
together than could be resolved. I suspect this is what is happening
here, because everything looks fine on my latest build.

Ben Root

Mike,

Using svn trunk, I see exactly the problem Jens is talking about. Maybe there is still a bug in the path simplification? If I try to plot after turning simplification off, I don't get any image at all, so I can't immediately say whether the problem is in the simplification.

To reproduce the bug, run the example Jens supplied, and try changing the window width a few times.

Eric

···

On 08/31/2010 01:08 AM, Jens Nie wrote:

Hi everyone.
I face a problem here, which I can’t seem to handle by myself, so any
help is really appreciated.
I would like to do a simple line plot of a huge dataset as an overview
to quickly compare success of different measurement scenarios, and it
seems that not every datapoint is displayed. I played a little with the
lod parameter, both for the creation of the axis and the plot command.
However timing the plot command and the display itself do not show
differences. Here are a few lines of code that help to reproduce the
problem.
import time
import matplotlib
matplotlib.use("Qt4Agg")
import matplotlib.pyplot as plt
import numpy as np
xData=np.linspace(0, 10.0, 1e6)
yData=np.zeros(xData.shape)
xDataDetail=np.linspace(0.0, 2*np.pi, 1000)
yDataDetail=np.exp(-xDataDetail)*np.sin(10.0*xDataDetail)
yData[100000:100000+len(yDataDetail)]=yDataDetail
fig=plt.figure()
axes=fig.add_subplot(111)
tic=time.time()
axes.plot(xData, yData, "b-")
toc=time.time()
axes.grid(True)
print "Plotting took %g s." % (toc-tic)
plt.show()
The code shows how I usually use the matplotlib environment and creates
a simple dataset of 1 million zeros with a short non trivial peak
within, that is to be plotted as a blue solid line.
You can see what happens, when you vary the width of the displaying
window. On my system usually the minimum amplitude varies when resizing
the window.
Is there any way to enforce plotting each and every point?
I use matplotlib version 1.0.0 on a 32 Bit windows XP system installed
via the windows installer from sf.
A quick check on a opensuse 11.3 linux box showed the same issue. Using
the “standard” TK backend instead of Qt4Agg behaves just the same.
Jens

------------------------------------------------------------------------------
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi everyone.
I face a problem here, which I can’t seem to handle by myself, so any
help is really appreciated.
I would like to do a simple line plot of a huge dataset as an overview
to quickly compare success of different measurement scenarios, and it
seems that not every datapoint is displayed. I played a little with the
lod parameter, both for the creation of the axis and the plot command.
However timing the plot command and the display itself do not show
differences. Here are a few lines of code that help to reproduce the
problem.

Jens,

I'm confident this is the same bug as was reported more recently on the list and the tracker:

https://sourceforge.net/tracker/index.php?func=detail&aid=3058804&group_id=80706&atid=560720

That report will make it easier to debug because it illustrates the problem with a relatively few points.

Eric

···

On 08/31/2010 01:08 AM, Jens Nie wrote:

import time
import matplotlib
matplotlib.use("Qt4Agg")
import matplotlib.pyplot as plt
import numpy as np
xData=np.linspace(0, 10.0, 1e6)
yData=np.zeros(xData.shape)
xDataDetail=np.linspace(0.0, 2*np.pi, 1000)
yDataDetail=np.exp(-xDataDetail)*np.sin(10.0*xDataDetail)
yData[100000:100000+len(yDataDetail)]=yDataDetail
fig=plt.figure()
axes=fig.add_subplot(111)
tic=time.time()
axes.plot(xData, yData, "b-")
toc=time.time()
axes.grid(True)
print "Plotting took %g s." % (toc-tic)
plt.show()
The code shows how I usually use the matplotlib environment and creates
a simple dataset of 1 million zeros with a short non trivial peak
within, that is to be plotted as a blue solid line.
You can see what happens, when you vary the width of the displaying
window. On my system usually the minimum amplitude varies when resizing
the window.
Is there any way to enforce plotting each and every point?
I use matplotlib version 1.0.0 on a 32 Bit windows XP system installed
via the windows installer from sf.
A quick check on a opensuse 11.3 linux box showed the same issue. Using
the “standard” TK backend instead of Qt4Agg behaves just the same.
Jens

------------------------------------------------------------------------------
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I believe this is now fixed in r8691 (branch and trunk).

Mike

···

On 09/03/2010 02:51 PM, Eric Firing wrote:

On 08/31/2010 01:08 AM, Jens Nie wrote:
   

Hi everyone.
I face a problem here, which I can�t seem to handle by myself, so any
help is really appreciated.
I would like to do a simple line plot of a huge dataset as an overview
to quickly compare success of different measurement scenarios, and it
seems that not every datapoint is displayed. I played a little with the
lod parameter, both for the creation of the axis and the plot command.
However timing the plot command and the display itself do not show
differences. Here are a few lines of code that help to reproduce the
problem.
     

Jens,

I'm confident this is the same bug as was reported more recently on the
list and the tracker:

https://sourceforge.net/tracker/index.php?func=detail&aid=3058804&group_id=80706&atid=560720

That report will make it easier to debug because it illustrates the
problem with a relatively few points.

Eric

import time
import matplotlib
matplotlib.use("Qt4Agg")
import matplotlib.pyplot as plt
import numpy as np
xData=np.linspace(0, 10.0, 1e6)
yData=np.zeros(xData.shape)
xDataDetail=np.linspace(0.0, 2*np.pi, 1000)
yDataDetail=np.exp(-xDataDetail)*np.sin(10.0*xDataDetail)
yData[100000:100000+len(yDataDetail)]=yDataDetail
fig=plt.figure()
axes=fig.add_subplot(111)
tic=time.time()
axes.plot(xData, yData, "b-")
toc=time.time()
axes.grid(True)
print "Plotting took %g s." % (toc-tic)
plt.show()
The code shows how I usually use the matplotlib environment and creates
a simple dataset of 1 million zeros with a short non trivial peak
within, that is to be plotted as a blue solid line.
You can see what happens, when you vary the width of the displaying
window. On my system usually the minimum amplitude varies when resizing
the window.
Is there any way to enforce plotting each and every point?
I use matplotlib version 1.0.0 on a 32 Bit windows XP system installed
via the windows installer from sf.
A quick check on a opensuse 11.3 linux box showed the same issue. Using
the �standard� TK backend instead of Qt4Agg behaves just the same.
Jens

------------------------------------------------------------------------------
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
     
------------------------------------------------------------------------------
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA