## matplotlib-users

 [Matplotlib-users] Plotting time on x-axis From: Roberto Aguilar - 2006-09-06 17:09:09 ```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. ```
 Re: [Matplotlib-users] Plotting time on x-axis From: Roberto Aguilar - 2006-09-08 19:42:57 ```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 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. > ```