469,890 Members | 2,164 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

matplotlib question

basically I need to plot a graph of data vs time. However when i use
matplotlib the hr:min tick marks come out very close together and
appear jumbled. So 12:00 comes out very close to 12:30 for example.
There are two things I would like to do. First, is to increase
the horizontal dimension of the graph. So basically increase the
horizontal number of pixels. The data will always be from
midnight to midnight it's just that i want it stretched out
more horizontally. Also, how do i specify that i only want hourly
tickmarks. So under the x-axis i only want to see 12:00 1:00 etc.

thanks
Jun 27 '08 #1
1 1341
asdf wrote:
basically I need to plot a graph of data vs time. However when i use
matplotlib the hr:min tick marks come out very close together and
appear jumbled.
You need to look up the matplotlib.dates package - it's covered briefly in
the tutorial at http://matplotlib.sourceforge.net/tutorial.html

At a guess, you want something along the lines of this...

from matplotlib.dates import YearLocator, MonthLocator, WeekdayLocator, \
DayLocator, HourLocator, MinuteLocator, SecondLocator, \
DateFormatter

subplot.xaxis.set_major_locator(HourLocator(range( 0,24,6)))
subplot.xaxis.set_major_formatter(DateFormatter("% a %H:%M"))
subplot.xaxis.set_minor_locator(HourLocator(range( 0,24,1)))

....but you'll probably need to look up the documentation to get the details
to suit what you need.

Hope that helps!
--
I'm at CAMbridge, not SPAMbridge
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by John Hunter | last post: by
4 posts views Thread by Matt Feinstein | last post: by
8 posts views Thread by Derek Basch | last post: by
5 posts views Thread by John Henry | last post: by
12 posts views Thread by orangeDinosaur | last post: by
1 post views Thread by redcic | last post: by
4 posts views Thread by John Henry | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.