Hi there,
Currently i use these commands to layout and save my figures:
> figure
> ...
> gca.set_aspect('equal')
> gca.autoscale(tight=True)
> ...
> plt.savefig('fpp.png', bbox_inches='tight', pad_inches=0)
I would like to set the width of this png file, how to do that? If
savefig() does not support setting the width, maybe I can set the width
of my xaxis?
Thanks in advance, Keba
The size of the PNG will be based on the size of your figure object. When you create your figure, you can pass a figsize kwarg which takes a tuple of width, height in inches (defaults to 8 x 6, I think).
fig = plt.figure(figsize=(10.0, 6.0))
I hope that helps!
Ben Root
···
On Tue, Feb 28, 2012 at 3:48 PM, Mario Fuest <mariofuest@…2015…915…> wrote:
Hi there,
Currently i use these commands to layout and save my figures:
figure
…
gca.set_aspect(‘equal’)
gca.autoscale(tight=True)
…
plt.savefig(‘fpp.png’, bbox_inches=‘tight’, pad_inches=0)
I would like to set the width of this png file, how to do that? If
savefig() does not support setting the width, maybe I can set the width
of my xaxis?
Thanks in advance, Keba
With an existing Figure instance, you can also call
fig.set_figwidth(width_inches)
before saving (or set_figheight or set_size_inches)
http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure
JDH
···
On Feb 28, 2012, at 4:03 PM, Benjamin Root <ben.root@...1304...> wrote:
The size of the PNG will be based on the size of your figure object. When you create your figure, you can pass a figsize kwarg which takes a tuple of width, height in inches (defaults to 8 x 6, I think).
fig = plt.figure(figsize=(10.0, 6.0))