On Thu, Mar 15, 2012 at 6:01 AM, kususe <kus...@interfree.it> wrote:

>
> Hi folks,
> I'd like to remove the black border which is created when I save the image,
> letting just the white background and the graph.
> Is there a solution??
> Thanks,
> K.
> --


Matplotlib provides a function that *almost* does this: `plt.axis('off')`
or `ax.set_axis_off()`, but these functions clear the white background as
well (along with the ticks, spines, and axis labels).

The following snippet clears only the spines and ticks:

    ax.xaxis.set_ticks([])
    ax.yaxis.set_ticks([])
    for spine in ax.spines.itervalues():
        spine.set_visible(False)

I've wrapped this up into a utility function:
https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py

-Tony
------------------------------------------------------------------------------
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