Remove the white padding from a figure

Hello,

I try to find out how could I remove the white padding around my figure! I allready searched at google for a long time, but can’t find any that changed my problem. Ich create the figure with this two lines:

fig = plt.figure()
subfig = fig.add_subplot(111)

After adding some plots, lines, annonations … I change this:

plt.axis([a,b,c,d]])
plt.axes().set_aspect(‘equal’)

I need this for exporting the figure to EPS!

I’m using the matplotlib ‘0.98.5.2’.

···


Mit freundlichen Grüßen

Ronald Römer

Hi Ronald,

I use:

fig.savefig('graph.eps', bbox_inches='tight', pad_inches=0.03)

Play with the parameters and see what you like.

Hope that helps.

Regards,
-- Damon

···

--------------------------
Damon McDougall
Mathematics Institute
University of Warwick
Coventry
CV4 7AL
d.mcdougall@...831...

On 14 Jan 2010, at 15:57, Ronald Römer wrote:

Hello,

I try to find out how could I remove the white padding around my figure! I allready searched at google for a long time, but can't find any that changed my problem. Ich create the figure with this two lines:

fig = plt.figure()
subfig = fig.add_subplot(111)

After adding some plots, lines, annonations ... I change this:

plt.axis([a,b,c,d]])
plt.axes().set_aspect('equal')

I need this for exporting the figure to EPS!

I'm using the matplotlib '0.98.5.2'.

--
Mit freundlichen Grüßen

Ronald Römer
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

For eps files, I use epstool:
epstool --copy -b file.eps file_cropped.eps

It does not leave any whitespace, which is sometimes annoying.

Pierre

···

Le 14 janv. 10 à 17:52, Damon McDougall a écrit :

Hi Ronald,

I use:

fig.savefig('graph.eps', bbox_inches='tight', pad_inches=0.03)

Play with the parameters and see what you like.

Hope that helps.

Regards,
-- Damon

--------------------------
Damon McDougall
Mathematics Institute
University of Warwick
Coventry
CV4 7AL
d.mcdougall@...831...

On 14 Jan 2010, at 15:57, Ronald Römer wrote:

Hello,

I try to find out how could I remove the white padding around my figure! I allready searched at google for a long time, but can't find any that changed my problem. Ich create the figure with this two lines:

fig = plt.figure()
subfig = fig.add_subplot(111)

After adding some plots, lines, annonations ... I change this:

plt.axis([a,b,c,d]])
plt.axes().set_aspect('equal')

I need this for exporting the figure to EPS!

I'm using the matplotlib '0.98.5.2'.

--
Mit freundlichen Grüßen

Ronald Römer
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users