Sascha | 3 Oct 2005 15:23
Picon
Picon

Re: picture quality of the figures

Try changing the resolution to a value of 300 or 600 dpi. This should give you very high quality figures when using the Agg backend. The standard is 80 which is ok for screen display but for printing purposes you should use a higher value. See http://matplotlib.sourceforge.net/matplotlib.pylab.html#-figure (dpi keyword argument).
 
----- Original Message -----
Sent: Monday, October 03, 2005 2:38 PM
Subject: [Matplotlib-users] picture quality of the figures

Hello,
 
We are using matplotlib version 0.8 (matplotlib-0.80.win32-py2.2.exe).
 
The plots are saved as .png, but we feel the quality of this picture is not so good. (not good resolution supported).
Is there anyway by which we can improve the picture quality? Say like by using .jpeg.
 
We tried to save the plot as .jpeg as mentioned on the site (http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig)  , but we get error "IOError: Do not know know to handle extension *.jpeg...."
Does it mean that matplotlib 0.8 does not support jpeg format?
 
If anyone has an idea about this then please do let us know.
 
Thanks in advance
 
Best Regards,
Rameshwari
Chris Barker | 3 Oct 2005 18:48
Picon
Favicon

Re: picture quality of the figures

Sascha wrote:
> Try changing the resolution to a value of 300 or 600 dpi. This should
> give you very high quality figures when using the Agg backend. The
> standard is 80 which is ok for screen display but for printing
> purposes you should use a higher value. See
> http://matplotlib.sourceforge.net/matplotlib.pylab.html#-figure (dpi
> keyword argument).

Except that savefig() overrides the Figure dpi, so you need to pass the 
desired dpi in to the savefig function (or method):

savefig(filename, dpi=300)

-Chris

--

-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Ted Drain | 3 Oct 2005 17:02
Picon
Picon
Favicon

Re: picture quality of the figures

Rameshwari,
I think everyone else has given you enough pointers on increasing the 
resolution of your plots, I just thought I'd chime in w/ more info on JPEG.

JPEG is lossy compression format - it throws away information.  PNG is a 
loss-less compression format - it does not throw away information.  Since 
both formats start from the same raster image, you cannot increase your 
picture quality by changing formats, only by changing the original 
raster.  In particular, JPEG is a terrible format for plots.  It was 
designed to compress pictures and it cannot deal well with rapid changes in 
color in a image (like a black line on a white background).

Most JPEG compressed plots will show artifacts around all of the lines so 
instead of seeing the pixels (for a black line on a white background) like 
this:

         white, white, white, black, white, white, white

In a JPEG image, you would see:

         white, grey, grey, black, grey, grey, white

As others have already indicates, you can increase your DPI through various 
means or switch to PS (which uses vector based drawing commands instead of 
a set of pixels).

Ted

At 05:38 AM 10/3/2005, Vedpathak, Rameshwari  IN BLR SISL wrote:
>Hello,
>
>We are using matplotlib version 0.8 (matplotlib-0.80.win32-py2.2.exe).
>
>The plots are saved as .png, but we feel the quality of this picture is 
>not so good. (not good resolution supported).
>Is there anyway by which we can improve the picture quality? Say like by 
>using .jpeg.
>
>We tried to save the plot as .jpeg as mentioned on the site

>(<http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig>http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig) 
>, but we get error "IOError: Do not know know to handle extension *.jpeg...."
>Does it mean that matplotlib 0.8 does not support jpeg format?
>
>If anyone has an idea about this then please do let us know.
>
>Thanks in advance
>
>Best Regards,
>Rameshwari

Ted Drain     Jet Propulsion Laboratory   ted.drain@...    

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Picon

picture quality of the figures

Hello,
 
We are using matplotlib version 0.8 (matplotlib-0.80.win32-py2.2.exe).
 
The plots are saved as .png, but we feel the quality of this picture is not so good. (not good resolution supported).
Is there anyway by which we can improve the picture quality? Say like by using .jpeg.
 
We tried to save the plot as .jpeg as mentioned on the site (http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig)  , but we get error "IOError: Do not know know to handle extension *.jpeg...."
Does it mean that matplotlib 0.8 does not support jpeg format?
 
If anyone has an idea about this then please do let us know.
 
Thanks in advance
 
Best Regards,
Rameshwari
Favre-Nicolin Vincent | 3 Oct 2005 14:43
Picon

Re: picture quality of the figures

> We are using matplotlib version 0.8 (matplotlib-0.80.win32-py2.2.exe).
>
> The plots are saved as .png, but we feel the quality of this picture is
> not so good. (not good resolution supported).
> Is there anyway by which we can improve the picture quality? Say like by
> using .jpeg.

  Jpeg is will not be better- it is also a compressed format.

  A better quality can be obtained with postscript (*.ps) or encapsulated 
postscript (*.eps)

> We tried to save the plot as .jpeg as mentioned on the site
> (http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig)  ,
> but we get error "IOError: Do not know know to handle extension
> *.jpeg...."
> Does it mean that matplotlib 0.8 does not support jpeg format?

   Try with .jpg, not .jpeg

	Vincent
--

-- 
Vincent Favre-Nicolin
Université Joseph Fourier
http://v.favrenicolin.free.fr
ObjCryst & Fox : http://objcryst.sourceforge.net

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

Gmane