Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Martinho MA <mma@ua...>  20090113 20:17:18

Hello, I have a problem saving png files created from data with missing values. The matlab and pylab outputs are very different... pylab resolution is poorer !? the saving commands from matlab and python are similar: matlab: >>print dpng r80 test_matlab.png python: >>pylab.savefig('test_pylab.png',dpi=80) look at the examples: http://neptuno.fis.ua.pt/tmp/comp.html Can I get the pylab output with the quality of test_matlab.png? Thank you mma 
From: John Hunter <jdh2358@gm...>  20090113 20:33:19

On Tue, Jan 13, 2009 at 12:16 PM, Martinho MA <mma@...> wrote: > Hello, > I have a problem saving png files created from data with missing values. > The matlab and pylab outputs are very different... pylab resolution is > poorer !? > > the saving commands from matlab and python are similar: > > matlab: > >>print dpng r80 test_matlab.png > > python: > >>pylab.savefig('test_pylab.png',dpi=80) > > > look at the examples: > http://neptuno.fis.ua.pt/tmp/comp.html > > Can I get the pylab output with the quality of test_matlab.png? Without seeing any code or knowing anything about your matplotlib version  it is hard to help. http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reportaproblem JDH 
From: Darren Dale <dsdale24@gm...>  20090113 21:09:01
Attachments:
Message as HTML

Perhaps the interpolation needs to be set to 'nearest'? On Tue, Jan 13, 2009 at 3:33 PM, John Hunter <jdh2358@...> wrote: > On Tue, Jan 13, 2009 at 12:16 PM, Martinho MA <mma@...> wrote: > > Hello, > > I have a problem saving png files created from data with missing values. > > The matlab and pylab outputs are very different... pylab resolution is > > poorer !? > > > > the saving commands from matlab and python are similar: > > > > matlab: > > >>print dpng r80 test_matlab.png > > > > python: > > >>pylab.savefig('test_pylab.png',dpi=80) > > > > > > look at the examples: > > http://neptuno.fis.ua.pt/tmp/comp.html > > > > Can I get the pylab output with the quality of test_matlab.png? > > > Without seeing any code or knowing anything about your matplotlib > version  it is hard to help. > > > http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reportaproblem > > JDH > > >  > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sfspreadtheword > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Martinho MA <mma@ua...>  20090114 18:42:32

the script used and data file are at: http://neptuno.fis.ua.pt/tmp/comp.html the script is very simple, just: from numpy import savez,load, ma import pylab data = load('data.npz') lon = data['lon'] lat = data['lat'] sst = data['sst'] mask = data['mask'] sst=ma.masked_where(mask,sst) pylab.pcolor(lon,lat,sst) pylab.xlim([12.5,5.5]) pylab.ylim([34.5,45.5]) pylab.clim([12, 18]) pylab.savefig('filename.png') The matplotlib version is: In [2]: print matplotlib.__version__ 0.98.3 The python version is: In [5]: print sys.version 2.5.2 (r252:60911, Aug 1 2008, 00:37:21) [GCC 4.3.1 20080507 (prerelease) [gcc4_3branch revision 135036]] The machine is openSUSE 11.0 (X8664): >>uname a Linux c5 2.6.25.180.2default #1 SMP 2008...... I tried in windows xp, latest enthought python (python 2.5.2; EPD Py25 4.1.30101 (r252:60911, Dec 19 2008 ...) and the output is similar (to linux python) http://neptuno.fis.ua.pt/tmp/test_EPD.png Thanks for the help mma John Hunter wrote: > On Tue, Jan 13, 2009 at 12:16 PM, Martinho MA <mma@...> wrote: > >> Hello, >> I have a problem saving png files created from data with missing values. >> The matlab and pylab outputs are very different... pylab resolution is >> poorer !? >> >> the saving commands from matlab and python are similar: >> >> matlab: >> >>print dpng r80 test_matlab.png >> >> python: >> >>pylab.savefig('test_pylab.png',dpi=80) >> >> >> look at the examples: >> http://neptuno.fis.ua.pt/tmp/comp.html >> >> Can I get the pylab output with the quality of test_matlab.png? >> > > > Without seeing any code or knowing anything about your matplotlib > version  it is hard to help. > > http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reportaproblem > > JDH > 
From: Eric Firing <efiring@ha...>  20090114 22:36:05

Martinho MA wrote: > the script used and data file are at: > http://neptuno.fis.ua.pt/tmp/comp.html The blocks (quadrilaterals) defined by your data grid are quite a bit smaller than the pngfile pixels, so perhaps it is not surprising that matlab and mpl (via Agg) might be using different strategies to decide when to color a pixel in the image. How do you decide which one is a better representation of the data? What sort of downsampling algorithm do you want? (Not that you have a choice, short of writing your own code to generate the image from the data.) You can get closer to the Matlab result by adding to your pcolor call the kwargs antialiased=False, edgecolor='none'. It still looks like Agg is using a rule along the lines of "if there is any part of a patch in this pixel, color it", and maybe Matlab is taking the opposite approach. The Cairo renderer appears to be doing the same thing as Agg, and not to be respecting the antialiased kwarg; but I have not checked this very carefully. Instead of using pcolor, you can get a very similar result *much* faster by using: pylab.pcolormesh(lon, lat, sst, antialiased=False) Eric 
Sign up for the SourceForge newsletter:
No, thanks