plot_date bug.

Hi,

I'm trying to use plot_date to plot some USGS daily flow data. I seem to have hit a bug in the plotting where large spikes in data are not being plotted at all scales.

For example in the attached data file there is a spike in the flow that hits a maximum of 30700 on 1998-10-20. When plotted with the commands below this portion of the dataset does not show up. If I drag the plot window to make the x axis 2 to 3 times wider than normal there is point at which this data spike suddenly appears. This problem doesn't exist if I use a symbol like .,+ etc only with lines.

code:

08176500.zip (116 KB)

···

----
import datetime
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

qfile = '08176500.txt'

#q_file = qfile.split('.')[0].split('\\')[-1]
q_ts = np.genfromtxt(qfile,comments='#',dtype=None,usecols=(2,3),names='dates,discharge')
dt = np.array([datetime.date(year=int(date.split('-')[0]), month=int(date.split('-')[1]), day=int(date.split('-')[2])) for date in q_ts['dates']])
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot_date(mpl.dates.date2num(dt), q_ts['discharge'],'-')
plt.show()
----

Any help is appreciated.

thanks,

- dharhas

It's the known path simplification bug, which has been fixed in svn. If you can't run an mpl built from svn, the workaround is to turn off path simplification, e.g.

rcParams['path.simplify'] = False

or the equivalent in the matplotlibrc file.

Eric

···

On 05/24/2010 07:08 AM, Dharhas Pothina wrote:

Hi,

I'm trying to use plot_date to plot some USGS daily flow data. I seem to have hit a bug in the plotting where large spikes in data are not being plotted at all scales.