On Mon, Feb 28, 2011 at 10:48 AM, Andrea Crotti <andrea.crotti.0@gmail.com> wrote:
So since I wanted some space on the borders of my graph, I did this
really extremely convoluted thing, which apparently works...
I get a 10% more area on each side, but I'm quite sure there's a better
way to this, right?

I didn't find any function to pass an increment to the size that's why I
did this mess...

--8<---------------cut here---------------start------------->8---
       old_axes = plt.axis()
       sizes = old_axes[1] - old_axes[0], old_axes[3] - old_axes[2]
       offset = lambda x: int((float(x) / 10))
       new_axes = []

       for i in range(len(old_axes)):
           new_val = old_axes[i] + (((-1) ** (i + 1)) * offset(sizes[i % 2]))

--8<---------------cut here---------------end--------------->8---

Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
Matplotlib-users mailing list


You can try:

fig, ax = plt.subplots(1,1)
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95)

If you choose WXAgg as your backend you get a nice config tool to adjust spacing in the figure. Then just pass those numbers into .subplots_adjust method once you are satisfied.