|
From: Anand S. <an...@st...> - 2012-10-09 14:11:30
|
I ask having trouble getting imshow to plot e.g. a detector image showing pixels as little rectangular or square uniform color blocks - imshow seems to want to interpolate or smooth the image.
Using imshow("nearest") still produces a 'soft' image.
I have solved this problem earlier using figimage(), but that was a lot of work (I had to create a pixel-by-pixel array with all greyscale values set myself, and then I was working in pixel coordinates rather than my data coordinates). Has anyone figured out how to get imshow to stop smoothing the image? Using imshow(… interpolation='none'…) or imshow(… interpolation=None…) raise exceptions.
I found NonUniformImage too hard to figure out from the documentation.
|
|
From: Benjamin R. <ben...@ou...> - 2012-10-09 14:26:10
|
On Tue, Oct 9, 2012 at 10:11 AM, Anand Sivaramakrishnan <an...@st...>wrote:
> I ask having trouble getting imshow to plot e.g. a detector image
> showing pixels as little rectangular or square uniform color blocks -
> imshow seems to want to interpolate or smooth the image.
> Using imshow("nearest") still produces a 'soft' image.
>
> I have solved this problem earlier using figimage(), but that was a lot
> of work (I had to create a pixel-by-pixel array with all greyscale values
> set myself, and then I was working in pixel coordinates rather than my data
> coordinates). Has anyone figured out how to get imshow to stop smoothing
> the image? Using imshow(… interpolation='none'…) or imshow(…
> interpolation=None…) raise exceptions.
>
> I found NonUniformImage too hard to figure out from the documentation.
>
>
If you are using mpl v1.1.x or greater, try interpolation='none'. Note,
that is the string 'none', not the python None.
Ben Root
|
|
From: Warren W. <war...@en...> - 2012-10-09 15:01:30
|
On Tue, Oct 9, 2012 at 10:11 AM, Anand Sivaramakrishnan <an...@st...>wrote:
> I ask having trouble getting imshow to plot e.g. a detector image
> showing pixels as little rectangular or square uniform color blocks -
> imshow seems to want to interpolate or smooth the image.
> Using imshow("nearest") still produces a 'soft' image.
>
That's strange. `imshow(img, interpolation='nearest')` works for me.
Warren
>
> I have solved this problem earlier using figimage(), but that was a lot
> of work (I had to create a pixel-by-pixel array with all greyscale values
> set myself, and then I was working in pixel coordinates rather than my data
> coordinates). Has anyone figured out how to get imshow to stop smoothing
> the image? Using imshow(… interpolation='none'…) or imshow(…
> interpolation=None…) raise exceptions.
>
> I found NonUniformImage too hard to figure out from the documentation.
>
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Pierre H. <pie...@cr...> - 2012-10-09 15:17:35
Attachments:
signature.asc
|
Hi, Le 09/10/2012 16:37, Warren Weckesser a écrit : > > That's strange. `imshow(img, interpolation='nearest')` works for me. > I'm not sure I understand well the subtle difference between 'nearest' and 'none' interpolations, but I found in this commit https://github.com/jkseppan/matplotlib/commit/6923c7f04fbafa23766250d710cc6b37373c816f a PDF file (interp_nearest_vs_none.pdf) which compares the output of imshow with these two different settings. It seems there is a difference in where the boundaries of pixels are... Maybe somebody familiar with this 'nearest' and 'none' topic could edit the interpolation example ? (http://matplotlib.org/examples/pylab_examples/image_interp.html) Best, Pierre |
|
From: Anand S. <an...@st...> - 2012-10-10 13:08:02
|
Thanks for the many useful responses - I eventuallyfound by experiment that imshow( interpolation='nearest' works *if* I write a png file. Saving a pdf file mushed up my crisp pixel boundaries. However, saving as png, then using (mac osx) preview to convert to pdf worked fine. Go figure()! I have solved this problem earlier using figimage(), but that was a lot of work (I had to create a pixel-by-pixel array with all greyscale values set myself, and then I was working in pixel coordinates rather than my data coordinates). Has anyone figured out how to get imshow to stop smoothing the image? Using imshow(… interpolation='none'…) or imshow(… interpolation=None…) raise exceptions. I found NonUniformImage too hard to figure out from the documentation. ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Matplotlib-users mailing list Mat...@li...<mailto:Mat...@li...> https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Damon M. <dam...@gm...> - 2012-10-11 10:02:23
|
On Wed, Oct 10, 2012 at 3:07 PM, Anand Sivaramakrishnan <an...@st...> wrote: > Thanks for the many useful responses - I eventuallyfound by experiment that > imshow( interpolation='nearest' works *if* I write a png file. > Saving a pdf file mushed up my crisp pixel boundaries. However, saving as > png, then using (mac osx) preview to convert to pdf worked fine. This will almost surely produce a rasterised pdf (tick labels, axes labels, etc). You may or may not care about this. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom |
|
From: Eric F. <ef...@ha...> - 2012-10-12 05:51:38
|
On 2012/10/10 3:07 AM, Anand Sivaramakrishnan wrote: > Thanks for the many useful responses - I eventuallyfound by experiment > that imshow( interpolation='nearest' works *if* I write a png file. > Saving a pdf file mushed up my crisp pixel boundaries. However, saving > as png, then using (mac osx) preview to convert to pdf worked fine. > Go figure()! This doesn't seem right to me, that pdf would be "mushed". Would you supply an example, please? Ideally a simple script with the png result and the mpl pdf result? Eric > >> >> >> I have solved this problem earlier using figimage(), but that was >> a lot of work (I had to create a pixel-by-pixel array with all >> greyscale values set myself, and then I was working in pixel >> coordinates rather than my data coordinates). Has anyone figured >> out how to get imshow to stop smoothing the image? Using imshow(… >> interpolation='none'…) or imshow(… interpolation=None…) raise >> exceptions. >> >> I found NonUniformImage too hard to figure out from the documentation. >> >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New >> Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |