From: Maria Khomenko <maria.khomenko@ut...> - 2005-06-17 15:26:51
I am having a problem with plotting a single piece of data on the graph.
This is the code I am trying to run:
a = 
d = 
new_date = [dates.date2num(datetime.fromtimestamp(d))]
fig = Figure()
canvas = FigureCanvasAgg(fig)
ax = fig.gca()
dayloc = dates.DayLocator()
datform = dates.DateFormatter('%b %d')
ax.plot_date(new_date, a, 'b-')
What happens is that the date axis (x-axis) seems to get values printed very
close to each other, in fact they seems to be overlapping each other so much,
all I see is an uneven black line on the bottom of the graph where the dates
For this graph, usually there is more than one date and then I want the graph to
automatically set the range for me, but in this case I am not sure how to set
the axis to show the date I plot plus a few more on each side decently spaced.
The problem does not appear for the y-axis where it shows a few integers to each
side of '3'.
Any help with this will be appreciated.
University of Toronto, Argon Team
From: John Hunter <jdhunter@ac...> - 2005-06-17 19:12:53
>>>>> "Maria" == Maria Khomenko <maria.khomenko@...> writes:
Maria> Hi, I am having a problem with plotting a single piece of
Maria> data on the graph. This is the code I am trying to run:
Maria> a =  d =  new_date =
Ahh, that was pesky. The basic problem is how to autoscale the
interval from a single data point. All the naieve ideas
vmin = p-1
vmax = p+1
vmin = 1.001*p
vmax = 0.999*p
can fail badly in some cases. That is what is happening here. You
chose a DayLocator, and the autoscaler did the plus/minus 0.001*p
trick. Since the single date point was 732104.79, the date range was
-732 days to +732 days which is a lot of ticks!
I modified the date tick locators to handle this case automatically
since only the locator can determine a suitable date range from a
Changes in CVS.