Make the area a bit larger

Andrea Crotti, on 2011-03-01 10:29, wrote:

Gökhan Sever <gokhansever@...287...> writes:
> You can try:
>
> fig, ax = plt.subplots(1,1)
> ax.plot(range(10))
> fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95)
>

Uhm strange, with the version of matplotlib that I have know I have
subplots_adjust, but I don't have plt.subplots, was it added later?
Well I can also leave my very convoluted way for now, I'll see later
what to do...

plt.subplots was added somewhat recently - in this instance it's
equivalent to :

fig = plt.figure()
ax = plt.subplot(1,1,1)

Andrea Crotti, on 2011-03-01 12:58, wrote:

Paul Ivanov <pivanov314@...287...> writes:
> You can do this with:
>
> ax = plt.subplot(111)
> ax.plot(range(10))
> ax.set_ymargin(.2)
> ax.set_xmargin(.1)
> # or ax.margins(.1,.2)
> ax.autoscale()
> plt.draw()
>
> see also the docstring for ax.autoscale_view for more.

Uhm also autoscale and set_xmargin are not implemented in my version of
matplotlib, too bad I'll just keep my hack for now...

Ok, these were added within the past year as well. I think you
should have an older version of ax.autoscale_view which does
something similar - but it's effectively what you have done in
your original example (though I'm not sure why you want
cast everything as an int there, perhaps that's just what makes
sense for the data you have).

you can see the current code here, if you're curious:
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes.py#L1774

best,

···

--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7