tags:

views:

480

answers:

2

Hi everyone!
Is there an easy way to draw a date/value chart in Python, if the "dates" axis had non-equidistant values?
For example, given these:

2009-02-01: 10
2009-02-02: 13
2009-02-07: 25
2009-03-01: 80

I'd like the chart to show that between the 2nd and 3nd value there's a longer gap than between the 1st and the 2nd.
I tried a few chart libraries but they all seem to assume that the X axis has non-scalar values..
(Side note: the chart should be exportable to PNG/GIF/whatever)
Thanks for your time!

+1  A: 

If it is enough for you to get a PNG with the chart, you can use Google Chart API which will give you a PNG image you can save. You could also use your data to parse the URL using Python.

EDIT: Image URL for your example (very basic).

schnaader
So you'd suggest to "convert" the date values to decimal ones and plot those on a XY chart.. I think I'll try with Unix timestamps and see if I can keep the "correct" labels :)
Joril
+2  A: 

you should be able to do this with matplotlib barchart. you can use xticks to give the x-axis date values, and the 'left' sizes don't have to be homogeneous. see the documentation for barchart for a full list of parameters.

Autoplectic