figimage filling entire image

Hello,

I'm trying to get a figimage to be scaled up dimensionally to occupy the
entire plot window rather than scrunched up in the upper left. The docs
cryptically suggest:

" * origin is either 'upper' or 'lower', which indicates where the [0,0]
    index of the array is in the upper left or lower left corner of
    the axes. Defaults to the rc image.origin value

This complements the axes image which will be resampled to fit the
current axes. If you want a resampled image to fill the entire
figure, you can define an Axes with size [0,1,0,1]."

But that is too cryptic for my current knowledge state. The following
creates a scrunched image:

figure(1)
d=rand(100, 100)
figimage(d)
show()

But this, probably naive guess, errors out with a
transformation-not-invertible message:

figure(1)
axes([0,1,0,1])
d=rand(100, 100)
figimage(d)
show()

Suggestions appreciated. Thanks,

Rich

If you want an image to spatially scale with the plot window, use
implot instead of figimage. Figimage does not resample images spatially
but rather displays them pixel for pixel (that's what distinguishes
the two functions)

Perry Greenfield

···

-----Original Message-----
From: matplotlib-users-admin@lists.sourceforge.net
[mailto:matplotlib-users-admin@lists.sourceforge.net]On Behalf Of Rich
Drewes
Sent: Wednesday, February 16, 2005 11:24 PM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] figimage filling entire image

Hello,

I'm trying to get a figimage to be scaled up dimensionally to occupy the
entire plot window rather than scrunched up in the upper left. The docs
cryptically suggest:

" * origin is either 'upper' or 'lower', which indicates where the [0,0]
    index of the array is in the upper left or lower left corner of
    the axes. Defaults to the rc image.origin value

This complements the axes image which will be resampled to fit the
current axes. If you want a resampled image to fill the entire
figure, you can define an Axes with size [0,1,0,1]."

But that is too cryptic for my current knowledge state. The following
creates a scrunched image:

figure(1)
d=rand(100, 100)
figimage(d)
show()

But this, probably naive guess, errors out with a
transformation-not-invertible message:

figure(1)
axes([0,1,0,1])
d=rand(100, 100)
figimage(d)
show()

Suggestions appreciated. Thanks,

Rich

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks for your response. I am familiar with implot however I've never
been able to get it to plot with distinct pixel boundaries. What I want
is a figimage-like plot with distinct, single-color regions, just larger
regions, so that the entire screen window is filled. No smoothing or
interpolation, just big chunky pixels.

Can this be done?

Rich

···

On Thu, 17 Feb 2005, Perry Greenfield wrote:

If you want an image to spatially scale with the plot window, use
implot instead of figimage. Figimage does not resample images spatially
but rather displays them pixel for pixel (that's what distinguishes
the two functions)

Sure. To fill the entire window:

axes((0,0,1,1)) # defines the axes bound to use the whole figure region (i.e, window)
imshow(imdata, interpolation="nearest") # use nearest neighbor interpolation to rescale image

Is this what you are looking for?

Perry

···

On Feb 17, 2005, at 10:22 AM, Rich Drewes wrote:

On Thu, 17 Feb 2005, Perry Greenfield wrote:

If you want an image to spatially scale with the plot window, use
implot instead of figimage. Figimage does not resample images spatially
but rather displays them pixel for pixel (that's what distinguishes
the two functions)

Thanks for your response. I am familiar with implot however I've never
been able to get it to plot with distinct pixel boundaries. What I want
is a figimage-like plot with distinct, single-color regions, just larger
regions, so that the entire screen window is filled. No smoothing or
interpolation, just big chunky pixels.

Can this be done?

Rich

Yes! There is (I think) an error in the documentation, both HTML online
(http://matplotlib.sourceforge.net/matplotlib.pylab.html#-figimage) and
also the .pdf version, where it says this:

"you can define an Axes with size [0,1,0,1]"

The order of the points is wrong there, and you set me straight.

Thanks much,
Rich

···

On Thu, 17 Feb 2005, Perry Greenfield wrote:

Sure. To fill the entire window:

axes((0,0,1,1)) # defines the axes bound to use the whole figure region