473,395 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1439
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Hunter | last post by:
matplotlib is a 2D plotting library for python. You can use matplotlib interactively from a python shell or IDE, or embed it in GUI applications (WX, GTK, and Tkinter). matplotlib supports many...
2
by: Dr. Colombes | last post by:
MatPlotLib question: How to get more different size plot symbols in the plot function ? Is there a way to get different size squares (or circles or triangles, etc.) ? For example, in a two...
4
by: Matt Feinstein | last post by:
Hi all-- I'm planning to try to do a completely local install of matplotlib (in Fedora Core 1)-- the system administrator isn't going to stop me-- but he isn't going to cooperate either. I've...
8
by: Derek Basch | last post by:
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. ...
5
by: John Henry | last post by:
I've been asking this question at the matplotlib user list and never gotten an answer. I am hoping that there are matplotlib users here that can help. My problem with matplotlib's way of...
12
by: orangeDinosaur | last post by:
Hi, I am exploring the possibility of using python as a replacement of MATLAB when I leave school. So, I've been playing with matplotlib and have run into some weird behavior after recently...
1
by: redcic | last post by:
I've got a question regarding matplotlib. I use the command: pylab.plot(...) to create a graph. Then, the execution of the code stops after the line: pylab.show() which is off course the last...
3
by: vajratkarviraj | last post by:
i hav python2.5, matplotlib0.90.1, and py2exe for python 2.5 all on windows xp... i hav a python program(letsc.py) which uses the matplotlib package... and i want 2 make an exe of it for distribution...
4
by: John Henry | last post by:
Has anybody been able to create an exe of their python applications involving matplotlib using pyinstall (ver 1.3)? I am getting a: RuntimeError: Could not find the matplotlib data files when...
0
by: PamMish1982 | last post by:
Hi all, I have recently started using Python and I am trying to make a GUI out of Tkinter. I am using matplotlib for the graphic purposes. I have to make a exe file from this code. I use py2exe...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.