Hi Goyo,

Thanks a lot. tight='True' worked fine in my autoscale_view(). It's doing just 
what I needed.

I have to confess that object-oriented programming seems very counter-intuitive 
to me.
Hopefully it will come more naturally soon.

Along the same lines of my original query, this one I think is more obscure, so 
here it goes:

Same script, just another .csv file with the same format. This time around, the 
plot comes up
with UTC times for the labels on the x-axis. The first one came with the dates. 

Does anybody know how to tell matplotlib to always put dates?

Here is the code again:

from matplotlib.dates import strpdate2num
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import numpy as np
from pylab import *

datafile = ('t2vst2.csv')
print 'loading', datafile

times, temp1, temp2 = np.loadtxt(
    datafile, delimiter=',',
    converters={0:strpdate2num('%d-%b-%y-%H:%M:%S') },
    skiprows=1, usecols=(0,1,2), unpack=True)

fig = figure()
ax = fig.add_subplot(111)
ax.plot_date(times, temp1, 'r-',linewidth=2.0)
ax.plot_date(times, temp2, 'g-',linewidth=2.0)
ax.autoscale_view(tight='True', scalex=True, scaley=False)
fig.autofmt_xdate()
show()


Thanks again.


________________________________
From: Goyo <goyod...@gmail.com>
To: Luciano Fleischfresser <l...@utfpr.edu.br>
Cc: Luciano Fleischfresser <l_...@yahoo.com>; 
matplotlib-users@lists.sourceforge.net
Sent: Wed, March 9, 2011 5:59:19 PM
Subject: Re: [Matplotlib-users] Axes formatting

2011/3/9 Luciano Fleischfresser <l_...@yahoo.com>:
> [...]
> Does anybody know how to make the plot area start right at the
> beginning of data and finish right at the end, so it spans the whole x axis?

I think this should do the trick:

axes.autoscale(axis='x',  tight='True')

Goyo
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to