On Thu, Sep 16, 2010 at 1:27 PM, <t...@ssl.berkeley.edu> wrote:
>
> I'm sampling voltages and currents at a millisecond resolution and placing
> the data in files. Example:
>
> 2010-01-01 01:01:00.000,-6933.0
> 2010-01-01 01:01:00.001,-6933.0
> 2010-01-01 01:01:00.002,-6925.0
> 2010-01-01 01:01:00.003,-6914.0
> 2010-01-01 01:01:00.004,-6905.0
> 2010-01-01 01:01:00.005,-6933.0
> 2010-01-01 01:01:00.006,-6925.0
>
> Then I use plotfile to plot the data:
>
> import matplotlib.pyplot as plt
> plt.plotfile(fname,(0,1))
> plt.show()
>
>
Teq,
First, when you use plotfile without giving the names of the columns, it
automatically uses the values in the first row as the title of the columns.
Therefore, you lose a row of data for plotting.
Now, for displaying the x axis ticks nicely, you have to identify the x data
column by the name of 'date'. Try this:
import matplotlib.pyplot as plt
plt.plotfile(fname, ('date', 'val'), names=('date', 'val'))
plt.show()
The y-axis data can be named anything you like, I just use 'val' here for
consistency.
Note: This still does not fix your problem with the limits of the x axis...
that is a separate issue with automatic setting of the limits. The problem
here is that the autoticker uses .toordinal() (I believe) to convert the
datetime data into a numerical representation. The limits you have for the
x axis is (733043.04236111115, 734503.04236118053), which is centered around
roughly 733773. This value is what you get for toordinal() on all of the
objects in that data snippet. This leads pyplot to believe that this is a
singular axis and has to do some tricks to display it.
I am not familiar enough with datetime to know how to deal with this
situation properly. Anybody else have any advice?
Ben Root
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users