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
···
On Tue, Oct 9, 2012 at 10:11 AM, Anand Sivaramakrishnan <anand@…86…> 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.
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
···
On Tue, Oct 9, 2012 at 10:11 AM, Anand Sivaramakrishnan <anand@…86…> wrote:
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!
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
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...
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!
This will almost surely produce a rasterised pdf (tick labels, axes
labels, etc). You may or may not care about this.
···
On Wed, Oct 10, 2012 at 3:07 PM, Anand Sivaramakrishnan <anand@...86...> 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.
--
Damon McDougall http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
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
···
On 2012/10/10 3:07 AM, Anand Sivaramakrishnan wrote:
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
Matplotlib-users@lists.sourceforge.net
<mailto:Matplotlib-users@lists.sourceforge.net> matplotlib-users List Signup and Options
------------------------------------------------------------------------------
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