imlim in ax.imshow

I don't understand what you mean by 'beauty'. If your image is 100
pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
that doesn't do what you want?

···

On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 11:09 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 6:33 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root <ben.root@...1304...> wrote:

On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye <kmichael.aye@...287...> wrote:

Hi!

I see that the function ax.imshow takes the parameter 'imlim' but in
the source (status: EPD 7.3-2) it is not being used?
So what is it for?

Best regards,
Michael

Confirmed. I don't see imlim anywhere except in the imshow() signature. I
have no recollection of this parameter, so it might be from before my time.

Ben Root

Is there some functionality you were looking for or were you just
exploring the codebase?

How nice of you to ask! :wink:
Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot?

Michael

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Is the 'extent' keyword what you're looking for?

No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty.

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Hi!

I see that the function ax.imshow takes the parameter 'imlim' but in
the source (status: EPD 7.3-2) it is not being used?
So what is it for?

Best regards,
Michael

Confirmed. I don't see imlim anywhere except in the imshow() signature. I
have no recollection of this parameter, so it might be from before my time.

Ben Root

Is there some functionality you were looking for or were you just
exploring the codebase?

How nice of you to ask! :wink:
Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot?

Michael

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Is the 'extent' keyword what you're looking for?

No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty.

I don't understand what you mean by 'beauty'. If your image is 100
pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
that doesn't do what you want?

As I wrote, that's not what is happening. I get extent=[-10,110,0,50].

···

On Oct 2, 2012, at 12:06 PM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 11:09 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 6:33 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root <ben.root@...1304...> wrote:

On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye <kmichael.aye@...287...> wrote:

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

The following script works for me:

import numpy as np
import matplotlib.pyplot as plt

image = np.random.random((100,50))

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.imshow(image, extent=[0,100,0,50])
plt.show()

···

On Tue, Oct 2, 2012 at 8:07 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 12:06 PM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 11:09 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 6:33 AM, Damon McDougall <damon.mcdougall@...1896....> wrote:

On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root <ben.root@...1304...> wrote:

On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye <kmichael.aye@...287...> wrote:

Hi!

I see that the function ax.imshow takes the parameter 'imlim' but in
the source (status: EPD 7.3-2) it is not being used?
So what is it for?

Best regards,
Michael

Confirmed. I don't see imlim anywhere except in the imshow() signature. I
have no recollection of this parameter, so it might be from before my time.

Ben Root

Is there some functionality you were looking for or were you just
exploring the codebase?

How nice of you to ask! :wink:
Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot?

Michael

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Is the 'extent' keyword what you're looking for?

No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty.

I don't understand what you mean by 'beauty'. If your image is 100
pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
that doesn't do what you want?

As I wrote, that's not what is happening. I get extent=[-10,110,0,50].

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Which version of matplotlib are you using? Also, are you on a 32-bit machine or a 64-bit machine. This might be related to a bug we have seen recently.

Ben Root

···

On Tue, Oct 2, 2012 at 3:07 PM, K.-Michael Aye <kmichael.aye@…287…> wrote:

On Oct 2, 2012, at 12:06 PM, Damon McDougall <damon.mcdougall@…287…> wrote:

On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye <kmichael.aye@…287…> wrote:

On Oct 2, 2012, at 11:09 AM, Damon McDougall <damon.mcdougall@…287…> wrote:

On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye <kmichael.aye@…287…> wrote:

On Oct 2, 2012, at 6:33 AM, Damon McDougall <damon.mcdougall@…287…> wrote:

On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye <kmichael.aye@…287…> wrote:

Hi!

I see that the function ax.imshow takes the parameter ‘imlim’ but in

the source (status: EPD 7.3-2) it is not being used?

So what is it for?

Best regards,

Michael

Confirmed. I don’t see imlim anywhere except in the imshow() signature. I

have no recollection of this parameter, so it might be from before my time.

Ben Root

Is there some functionality you were looking for or were you just

exploring the codebase?

How nice of you to ask! :wink:

Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn’t it? (I.e. to use the exact xdata range and not try to beautify the plot?

Michael

Damon McDougall

http://www.damon-is-a-geek.com

B2.39

Mathematics Institute

University of Warwick

Coventry

West Midlands

CV4 7AL

United Kingdom

Is the ‘extent’ keyword what you’re looking for?

No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty.

I don’t understand what you mean by ‘beauty’. If your image is 100

pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]

that doesn’t do what you want?

As I wrote, that’s not what is happening. I get extent=[-10,110,0,50].

I think the problem is that Michael is using ImageGrid, and apparently it is not using the tight autoscaling that imshow normally uses by default.

Eric

···

On 2012/10/02 9:11 AM, Damon McDougall wrote:

On Tue, Oct 2, 2012 at 8:07 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 12:06 PM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 11:09 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye <kmichael.aye@...287...> wrote:

On Oct 2, 2012, at 6:33 AM, Damon McDougall <damon.mcdougall@...287...> wrote:

On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root <ben.root@...1304...> wrote:

On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye <kmichael.aye@...287...> wrote:

Hi!

I see that the function ax.imshow takes the parameter 'imlim' but in
the source (status: EPD 7.3-2) it is not being used?
So what is it for?

Best regards,
Michael

Confirmed. I don't see imlim anywhere except in the imshow() signature. I
have no recollection of this parameter, so it might be from before my time.

Ben Root

Is there some functionality you were looking for or were you just
exploring the codebase?

How nice of you to ask! :wink:
Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot?

Michael

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

Is the 'extent' keyword what you're looking for?

No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty.

I don't understand what you mean by 'beauty'. If your image is 100
pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50]
that doesn't do what you want?

As I wrote, that's not what is happening. I get extent=[-10,110,0,50].

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

The following script works for me:

import numpy as np
import matplotlib.pyplot as plt

image = np.random.random((100,50))

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.imshow(image, extent=[0,100,0,50])
plt.show()