# Plotting time on x-axis

Hello,

I'm creating a program that plots data in real-time. I want the
x-axis to be the time in HH:MM:SS. I'm still playing with the date
formatters, but have run into a problem where it seems the axis puts
in more points on the axis to make the plot fit nicely. For instance,
I want to have 120 data points (seconds) on the graph. Initially, the
x-axis starts at, say 0 and goes to 120 (I'd expect this to be 119).
The following second the x-axis should go from 1 to 120, then 2 to
121, etc. But instead, the x-axis goes from 0 to 140. Once 141
seconds have passed by, the axis shifts and goes from 20 to 160.

Is there any way to make the axis behave so that it keeps just 120
values on the axis and increment the values as described above?

Thanks!
-Roberto.

I found how to explicitly set the x-axis using the following command:

figure.gca().set_xlim([min, max])

-Roberto.

ยทยทยท

On 9/6/06, Roberto Aguilar <roberto.c.aguilar@...287...> wrote:

Hello,

I'm creating a program that plots data in real-time. I want the
x-axis to be the time in HH:MM:SS. I'm still playing with the date
formatters, but have run into a problem where it seems the axis puts
in more points on the axis to make the plot fit nicely. For instance,
I want to have 120 data points (seconds) on the graph. Initially, the
x-axis starts at, say 0 and goes to 120 (I'd expect this to be 119).
The following second the x-axis should go from 1 to 120, then 2 to
121, etc. But instead, the x-axis goes from 0 to 140. Once 141
seconds have passed by, the axis shifts and goes from 20 to 160.

Is there any way to make the axis behave so that it keeps just 120
values on the axis and increment the values as described above?

Thanks!
-Roberto.