473,574 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[matplotlib] Overlapping axis text

I got a really annoying problem with datetime graphs. The problem is
that with a long range time graph, the text on the x axis keeps
overlapping like here: http://durand.zephyrhosting.net/tremcs/graph_all.png

Would there be any way to fix this? I was thinking of rotating the
text so that there was enough space for each one but the best solution
would be to only display text with the right scale. IE, with a 7 day
graph, each day would have text, with a year long graph, each month
would be displayed, etc...

This is the code I use at the moment but its pretty messy:

import dateutil,pylab
from matplotlib.date s import MonthLocator, WeekdayLocator

fig = pylab.figure()
ax = fig.add_subplot (111)
days = MonthLocator() # every monday
months = MonthLocator() # every month
ax.xaxis.set_ma jor_locator(mon ths)
ax.xaxis.set_mi nor_locator(day s)

pylab.plot_date (pylab.date2num (dates), allkills, '.-', color='blue')
pylab.plot_date (pylab.date2num (dates), alldeaths, '.-',
color='red')
pylab.plot_date (pylab.date2num (dates), kills, '.-',
color='darkgree n')
pylab.plot_date (pylab.date2num (dates), deaths, '.-',
color='orange')
if legend == 1:
pylab.legend((" Total Kills","Total Deaths", "Single
Session Kills", "Single Session Deaths"), 'lower left')
pylab.xlabel('D ate')
pylab.ylabel('S tats')
ax2 = pylab.twinx()
pylab.plot_date (pylab.date2num (dates), allratio, '.-',
color='purple')
pylab.plot_date (pylab.date2num (dates), ratio, '.-',
color='yellow')
pylab.ylabel('R atio')
ax2.yaxis.tick_ right()
pylab.show()
Please excuse the extra tabbing, it's part of an if statement.
Sep 6 '08 #1
2 5108
Err...made a mistake there.

days = WeekdayLocator( ) # every monday
months = MonthLocator() # every month

That doesn't change my question though.

Thanks
Sep 6 '08 #2

try this:

fig.autofmt_xda te()

should help a lot =)

Cheers
--
View this message in context: http://www.nabble.com/-matplotlib--O...p20430433.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Nov 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1757
by: John Hunter | last post by:
matplotlib is a 2D plotting package for python with a matlab compatible syntax and output tested under linux and windows platforms. matplotlib-0.30 is available for download at http://matplotlib.sourceforge.net, and has many new features since the last major release. Multiple outputs matplotlib now supports postscript and GD output, as...
5
11764
by: Enigma Curry | last post by:
I'm playing around with matplotlib for the first time. I'm trying to make a very simple histogram of values 1-6 and how many times they occur in a sequence. However, after about an hour of searching I cannot make the histogram stay within the bounds of the grid lines. Here is my example: pylab.grid() x_values= pylab.hist(x_values,6)
2
18878
by: Caleb Hattingh | last post by:
Hi I tried several Google searches to no avail. I read through pretty much most of the online docs at the matplotlib sourceforge site, but didn't find what I was looking for. I went through the axis.py and ticker.py code today, trying to find out how to set the number of points (ticks) on an axis in Matplotlib. I know that something...
0
1232
by: dhn | last post by:
I am trying to automate the generation of scatterplots in matplotlib. The problem of where to put the labels is known as 'point-feature labeling' (a main application is in cartography, where cities and such are known as 'point features'). In general the problem is not easy. Some references: http://www.merl.com/reports/docs/TR96-04.pdf...
2
11642
by: Grant Edwards | last post by:
I downloaded examples/contour_demo.py, and it doesn't run. I've searched both the user guide and the Wiki for "contour" and got zero hits. http://matplotlib.sourceforge.net/matplotlib.pylab.html#-contour appears to be a good reference if you already know how to use contour(), but I could glean zero clues from it on how to actually use...
0
1932
by: Soren | last post by:
Hi, I'm trying to create a small GUI program where I can do plots using Matplotlib. I've been trying to borrow code from the examples at the matplotlib website, but I can't get it to work. I want to be able to create a wx.Panel that contains an axis for plotting. Around it i want other panels containing various settings, buttons etc. to...
4
3335
by: Bill Jackson | last post by:
Hi, I'm having some trouble plotting with the following matplotlibrc: text.usetex : True I tried clearing the cache files under ~/.matplotlib, but this did not help the problem. I'd post on the matplotlib mailing list, but I have a hard enough time browsing sourceforge's achives (frequent internal server errors). Here is some output:
0
1533
by: Dick Crepeau | last post by:
I would like to control the y axis of a plot. The following code does exactly what I want it to! On my linux computer it sets the y axis limits to 18.0 minimum, 58.0 maximum, plots some points on y=x, provides ticks at 20,30,40,50 and horizontal tick lines that intersect the plotted points. All very good, but if I change the upper y axis...
1
4637
by: Eric Holbrook | last post by:
I'm using matplotlib to generate (and save) plots of bandwidth data from simulation logs. Since the simulations are of varying lengths, i need a way to scale the axes so that every 100,000 points on the X-axis are roughly equal to the height of the Y-axis. In other words, if my X data varied from 0 to 575,000, my aspect ratio would be roughly...
0
7794
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7800
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8092
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5610
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5296
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2230
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1051
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.