>>>>> "Brinley," == Brinley, Chris <[EMAIL PROTECTED]> writes:

    Chris> Hi, I am having trouble getting a variation of the
    Chris> tutorial plot_date() to work. I get the classic:
    Chris> RuntimeError: xdata and ydata must be the same length.

Hmm, didn't know this had achieved classic status....

    Chris> The tutorial on the matplotlib site shows how to plot
    Chris> dates using whole days. I am plotting using multiple
    Chris> days showing each minute of the day.

    Chris> Before I run plot_date I setup to datetime vars and
    Chris> subtract them to get the timedelta so.. timedelta =
    Chris> enddate - startdate.

    Chris> I then use drange(startdate, enddate, timedelta)

This doesn't look right, since your delta equals the entire range.
Usually you want your delta to be smaller.

    Chris> I pass this range into the plot_date function with my y
    Chris> axis data, which I have confirmed is numeric and the
    Chris> same number of entries as the number of datetimes I want
    Chris> to plot.

Maybe you made a mistake here?  It sometimes happens when working
interactively that you add some bad data to a plot, realize your
mistake, then add good data, but still see the error.  When this
happens, it is usually because your "hold" state is on and the
previous data is still in your plot.  You can clear the figure with
fig.clf()

If you are still having a problem, post a complete example that we
can run.

    Chris> Clearly I am incorrectly telling plotlib the intervals
    Chris> of time I want to plot. What is the best way to plot out
    Chris> an interday chart that has ticks for each min?

  from matplotlib.dates import MinuteLocator
  ...

  # every minute
  ax.xaxis.set_major_locator(MinuteLocator()) 

  # or every 5 minutes
  ax.xaxis.set_major_locator(MinuteLocator(nx.arange(0,61,5)))

You'll probably also want to set the Formatter -- see the user's guide
chapter on tick locating and formatting and also

  http://matplotlib.sf.net/matplotlib.ticker.html
  http://matplotlib.sf.net/matplotlib.dates.html

and these examples

  mpl/examples> grep -l Locator *.py
  dashtick.py
  date_demo1.py
  date_demo2.py
  date_demo_convert.py 
  date_demo_rrule.py
  finance_demo.py
  major_minor_demo1.py
  major_minor_demo2.py
  stock_demo.py

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to