How to remove the black border in a Matplotlib figure

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.

···

--
View this message in context: http://old.nabble.com/How-to-remove-the-black-border-in-a-Matplotlib-figure-tp33508568p33508568.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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

···

On Thu, Mar 15, 2012 at 6:01 AM, kususe <kususe@…848…> 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.