Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: neurino <neurino@gm...>  20110209 10:53:24
Attachments:
Message as HTML

Hi, I'm a matplotlib newbie. An example is worth a thousand words: In [1]: matplotlib.__version__ Out[1]: '0.99.3' In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10) In [3]: plot(x, a); plot(x, b) Well all I see is an empty plot with the two horizontal lines at y=0 and y=1 covered by the upper and lower frame lines. Why aren't bounds set a little more larger so the two lines can show properly??? I guess this is a common situation, for example 2 or more stable temperatures: the higher and the lower never show... How can I fix it? Thanks for your support. 
From: Thomas Lecocq <thlecocq@ms...>  20110209 12:23:54
Attachments:
Message as HTML

This will do : pyplot.xlim(5,15) pyplot.ylim(5,5) HTH. Thomas ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** Date: Wed, 9 Feb 2011 11:53:17 +0100 From: neurino@... To: matplotlibusers@... Subject: [Matplotlibusers] Best way to set scales bounds to appropriate values Hi, I'm a matplotlib newbie. An example is worth a thousand words: In [1]: matplotlib.__version__ Out[1]: '0.99.3' In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10) In [3]: plot(x, a); plot(x, b) Well all I see is an empty plot with the two horizontal lines at y=0 and y=1 covered by the upper and lower frame lines. Why aren't bounds set a little more larger so the two lines can show properly??? I guess this is a common situation, for example 2 or more stable temperatures: the higher and the lower never show... How can I fix it? Thanks for your support.  The ultimate allinone performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/inteldev2devfeb _______________________________________________ Matplotlibusers mailing list Matplotlibusers@... https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: neurino <neurino@gm...>  20110209 12:47:07
Attachments:
Message as HTML

Well, not that automatic... I wonder why matplotlib takes care of settings limits on data but fails in a common situation so I'm forced to override it every time because I don't know in advance what data I get... Thanks anyway. Cheers neurino 2011/2/9 Thomas Lecocq <thlecocq@...> > This will do : > > pyplot.xlim(5,15) > pyplot.ylim(5,5) > > > HTH. > > Thomas > > ********************** > Thomas Lecocq > Geologist > Ph.D.Student (Seismology) > Royal Observatory of Belgium > ********************** > > > >  > Date: Wed, 9 Feb 2011 11:53:17 +0100 > From: neurino@... > To: matplotlibusers@... > Subject: [Matplotlibusers] Best way to set scales bounds to appropriate > values > > > Hi, I'm a matplotlib newbie. > > An example is worth a thousand words: > > In [1]: matplotlib.__version__ > Out[1]: '0.99.3' > > In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10) > > In [3]: plot(x, a); plot(x, b) > > Well all I see is an empty plot with the two horizontal lines at y=0 and > y=1 covered by the upper and lower frame lines. > > Why aren't bounds set a little more larger so the two lines can show > properly??? > I guess this is a common situation, for example 2 or more stable > temperatures: the higher and the lower never show... > > How can I fix it? > > Thanks for your support. > >  > The ultimate allinone performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. Find and fix more > than 250 security defects in the development cycle. Locate bottlenecks in > serial and parallel code that limit performance. > http://p.sf.net/sfu/inteldev2devfeb > _______________________________________________ Matplotlibusers mailing > list Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Thomas Lecocq <thlecocq@ms...>  20110209 12:53:02
Attachments:
Message as HTML

Neurino I'm sure : 1° there must be a parameter in the default behaviour of the subplot to control taht 2° you can always set xlim( min(X)/2, max(X)/2 ) ... Thomas ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** Date: Wed, 9 Feb 2011 13:47:01 +0100 Subject: Re: [Matplotlibusers] Best way to set scales bounds to appropriate values From: neurino@... To: thlecocq@... CC: matplotlibusers@... Well, not that automatic... I wonder why matplotlib takes care of settings limits on data but fails in a common situation so I'm forced to override it every time because I don't know in advance what data I get... Thanks anyway. Cheers neurino 2011/2/9 Thomas Lecocq <thlecocq@...> This will do : pyplot.xlim(5,15) pyplot.ylim(5,5) HTH. Thomas ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** Date: Wed, 9 Feb 2011 11:53:17 +0100 From: neurino@... To: matplotlibusers@... Subject: [Matplotlibusers] Best way to set scales bounds to appropriate values Hi, I'm a matplotlib newbie. An example is worth a thousand words: In [1]: matplotlib.__version__ Out[1]: '0.99.3' In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10) In [3]: plot(x, a); plot(x, b) Well all I see is an empty plot with the two horizontal lines at y=0 and y=1 covered by the upper and lower frame lines. Why aren't bounds set a little more larger so the two lines can show properly??? I guess this is a common situation, for example 2 or more stable temperatures: the higher and the lower never show... How can I fix it? Thanks for your support.  The ultimate allinone performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/inteldev2devfeb _______________________________________________ Matplotlibusers mailing list Matplotlibusers@... https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: Benjamin Root <ben.root@ou...>  20110209 16:59:44
Attachments:
Message as HTML

On Wed, Feb 9, 2011 at 6:47 AM, neurino <neurino@...> wrote: > Well, not that automatic... > > I wonder why matplotlib takes care of settings limits on data but fails in > a common situation so I'm forced to override it every time because I don't > know in advance what data I get... > > Thanks anyway. > > Cheers > neurino > > I did a little digging and I discovered a function I never noticed before... You can set a "margin" for an axis that can be used for autoscaling purposes. set_ymargin(self, m) method of matplotlib.axes.AxesSubplot instance Set padding of Y data limits prior to autoscaling. *m* times the data interval will be added to each end of that interval before it is used in autoscaling. accepts: float in range 0 to 1 So, in your code, if I set ymargin to 0.5, then the limits will automatically be 0.5 to 1.5. I think this is what you are looking for. Ben Root 
From: neurino <neurino@gm...>  20110209 20:30:12
Attachments:
Message as HTML

Thank you very much, that can help for sure! Unluckily matplotlib documentation is rather a jungle, just the lack of a methods/properties index for each class makes very hard to find what one's looking for. Thanks again. Greetings neurino 2011/2/9 Benjamin Root <ben.root@...> > On Wed, Feb 9, 2011 at 6:47 AM, neurino <neurino@...> wrote: > >> Well, not that automatic... >> >> I wonder why matplotlib takes care of settings limits on data but fails in >> a common situation so I'm forced to override it every time because I don't >> know in advance what data I get... >> >> Thanks anyway. >> >> Cheers >> neurino >> >> > I did a little digging and I discovered a function I never noticed > before... You can set a "margin" for an axis that can be used for > autoscaling purposes. > > set_ymargin(self, m) method of matplotlib.axes.AxesSubplot instance > Set padding of Y data limits prior to autoscaling. > > *m* times the data interval will be added to each > end of that interval before it is used in autoscaling. > > accepts: float in range 0 to 1 > > So, in your code, if I set ymargin to 0.5, then the limits will > automatically be 0.5 to 1.5. > > I think this is what you are looking for. > > Ben Root > > 
Sign up for the SourceForge newsletter:
No, thanks