Hi
I am developing on a Desktop install Ubuntu 9.04 machine with matplotlib 0.98.5.2,
and running the scripts on a Server install Ubuntu 8.10 machine with matplotlib 0.98.3.
I have found that the X axis layout for the same script varies between the two machines.
Both have standard matplotlib installs using apt-get. I haven’t made any tweaks.
Rather than go into great detail about the problem, please see the script below and links to the resulting png files.
I hope the png files tell the story.
http://waka.freehostia.com/python/date_axis_scaling_test.py
http://waka.freehostia.com/python/date_axis_scaling_test_0_98_3.png
http://waka.freehostia.com/python/date_axis_scaling_test_0_98_5_2.png
The plot produced by matplotlib 0.98.3 isn’t what I want.
Id like the plot to go edge to edge on the x axis grid, as the matplotlib 0.98.3 version does.
Help and advise would be appreciated.
PS : I’m new to python & matplotlib
···
######################################################################################
#!/usr/bin/env python
import matplotlib
matplotlib.use(‘Agg’)
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
version = matplotlib.version
HOURSBACK = 365 * 24
now = datetime.now()
valueList = []
dateList = []
for i in range(HOURSBACK):
hoursBack = timedelta( hours = (HOURSBACK - i) )
then = now - hoursBack
valueList.append( i )
dateList.append( then )
fig = plt.figure( figsize=(12, 9), dpi=100 )
ax = fig.add_subplot(111)
ax.plot(dateList, valueList)
plt.title(‘Date axis scaling test for matplotlib version : %s’ % ( version ) )
plt.grid(True)
plt.ylabel(‘Widgets’)
plt.xlabel(‘Date’)
fig.autofmt_xdate()
plt.savefig( “date_axis_scaling_test_%s.png” % version.replace(’.’,’_’), format=‘png’ )
quit()
######################################################################################
Upgrade to Internet Explorer 8 Optimised for MSN. Download Now