On 18 March 2012 08:43, klo uo <klo...@gmail.com> wrote:
> On Sun, Mar 18, 2012 at 1:07 PM, Angus McMorland <amcm...@gmail.com> wrote:
>>
>>
>>
>> The xlim command can be used to set the x limits. For example:
>>
>> xlim(-.5, 2.5)
>>
>> will prevent the points lying on the axis boundaries for your case.
>>
>
> Thanks Angus,
>
> that worked with ease for separate MPL window, but notĀ inlineĀ in IPython.

That's because the first command draws the plot, and when inlined,
further changes within the cell aren't propagated to the plot.

> I guess there is no setting, that will allow setting MPL to automatically
> adjust default plot window - add padding if bars (which can also be lines or
> points as in example) are drawn on axes; trim window if if there is no data
> to plot instead trimming based on grid range; and similar intuitive
> expectation

For inline ipython, you want to switch to the object-oriented use of
pylab. Something like this should work with xlim.

a = [0.1, 0.2, 0.1]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.errorbar(arange(3), a, yerr=a-sum(a)/len(a), fmt='ro')
ax.set_xlim(-.5,2.5)
ax.show()

I'm not aware of automatic settings for padding, but with this
set_xlim, it's easy enough to roll your own using the data limits.

Angus
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to