Hi,
I need to create a huge range of plots with need to fit into a report (OpenOffice or Word). In order to save the work of manual resizing them when dragged and dropped, I wanted to preset a correct figure size with a nice resolution:
pylab.rcParams[‘figure.figsize’] = 5,4
pylab.rcParams[‘figure.dpi’] = 300
Now, the created figure has a size of 500x400 pixels, and when I import it into a word processor, its dimensions are reported as 12.7x10.16cm², which matches the figsize definition. Yet, the resulting images are pretty much blurred…
How can I increase the resolution, or what am I doing wrong?
Thanks in advance,
Daniel
Daniel,
Did you try saving the figure with same dpi ?. Try the following.
plt.savefig(‘name’,dpi=300)
···
On Fri, Jan 21, 2011 at 9:08 AM, Daniel Mader <danielstefanmader@…982…> wrote:
Hi,
I need to create a huge range of plots with need to fit into a report (OpenOffice or Word). In order to save the work of manual resizing them when dragged and dropped, I wanted to preset a correct figure size with a nice resolution:
pylab.rcParams[‘figure.figsize’] = 5,4
pylab.rcParams[‘figure.dpi’] = 300
Now, the created figure has a size of 500x400 pixels, and when I import it into a word processor, its dimensions are reported as 12.7x10.16cm², which matches the figsize definition. Yet, the resulting images are pretty much blurred…
How can I increase the resolution, or what am I doing wrong?
Thanks in advance,
Daniel
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Bala subramanian, on 2011-01-21 12:17, wrote:
Daniel,
Did you try saving the figure with same dpi ?. Try the following.
plt.savefig('name',dpi=300)
> Hi,
>
> I need to create a huge range of plots with need to fit into a report
> (OpenOffice or Word). In order to save the work of manual resizing them when
> dragged and dropped, I wanted to preset a correct figure size with a nice
> resolution:
>
> pylab.rcParams['figure.figsize'] = 5,4
> pylab.rcParams['figure.dpi'] = 300
>
> Now, the created figure has a size of 500x400 pixels, and when I import it
> into a word processor, its dimensions are reported as 12.7x10.16cm², which
> matches the figsize definition. Yet, the resulting images are pretty much
> blurred...
>
> How can I increase the resolution, or what am I doing wrong?
Hi Daniel,
As Bala alluded - there's a difference between display dpi and
the file saving dpi. Your change to rcParams only affected the
displayed resolution, not the resolution of saved files.
Quoting from .matplotlibrc
# the default savefig params can be different from the display params
# Eg, you may want a higher resolution, or to make the figure
# background white
#savefig.dpi : 100 # figure dots per inch
So try playing around with that parameter (which is what you're
doing if you call plt.savefig('name', dpi=300)
best,
···
On Fri, Jan 21, 2011 at 9:08 AM, Daniel Mader < > danielstefanmader@...982...> wrote:
--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Ah, thank you very much, that helped! It works nicely!
Best regards,
Daniel