[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Non-linear axis data in imagesc
From: |
Ben Abbott |
Subject: |
Re: Non-linear axis data in imagesc |
Date: |
Fri, 02 Dec 2011 10:07:56 -0500 |
On Dec 2, 2011, at 9:12 AM, Daniel Arteaga wrote:
> On 02/12/11 14:29, Ben Abbott wrote:
>>
>> On Dec 2, 2011, at 8:20 AM, Daniel Arteaga wrote:
>>
>>> On 02/12/11 14:15, Ben Abbott wrote:
>>>> On Dec 2, 2011, at 6:52 AM, Daniel Arteaga wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> imagesc fails to display correctly non-linarly spaced axes. Instead it
>>>>> "invents" linear axis from the maximum value. See what I mean:
>>>>>
>>>>> x = logspace(0,5,20);
>>>>> y = logspace(0,2,10);
>>>>> A = rand(10,20);
>>>>> imagesc(x,y,A);
>>>>>
>>>>> Is this a bug? Any workaround to get the correct behaviour?
>>>>>
>>>>> Tested using GNU Octave Version 3.4.2 under Ubuntu 11.10.
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Daniel
>>>>
>>>> If you see (0,0) in the upper-left, then it is working as intended. Matlab
>>>> behaves this way as well.
>>>
>>> Sorry, I was not meaning that. What I was meaning is that the axis labels
>>> do not correspond to the x vector defined above. The real axis should be
>>> logarithmic, but imagesc invents a linear axis.
>>>
>>> Thank you,
>>>
>>> Daniel
>>
>> Ok. That *feature* is also inherited from Matlab.
>>
>> I've attached the result from Matlab (R2011b). Does it look the same as what
>> Octave produces for you?
>
> Yes, the result is essentially the same.
>
> Anyway, be in Matlab or Octave, the result is incorrect as I understand,
> since it is assigning values to the axis that do not match with the plotted
> data.
>
> In other words, for a given x and y value (according to the displayed axis),
> the color plotted is not the correct one.
>
> In my opinion, at least a warning should be displayed in this situation.
>
> Thank you very much,
>
> Daniel
I forgot to mention that you can work around ML's implementation. Does the
script below do what you want?
x = linspace(0,1e5,21);
y = linspace(0,1e2,11);
A = rand(11,21);
imagesc(x,y,A);
set (gca, "xtick", 0:20e3:1e5)
set (gca, "xticklabel", {"1", "10", "10^2", "10^3", "10^4", "10^5"})
set (gca, "ytick", [0, 50, 100])
set (gca, "yticklabel", {"1", "10", "10^2"})
Ben
- Non-linear axis data in imagesc, Daniel Arteaga, 2011/12/02
- Re: Non-linear axis data in imagesc, Ben Abbott, 2011/12/02
- Re: Non-linear axis data in imagesc, Daniel Arteaga, 2011/12/02
- Re: Non-linear axis data in imagesc, Ben Abbott, 2011/12/02
- Re: Non-linear axis data in imagesc, Daniel Arteaga, 2011/12/02
- Re: Non-linear axis data in imagesc, Ben Abbott, 2011/12/02
- Re: Non-linear axis data in imagesc,
Ben Abbott <=
- Re: Non-linear axis data in imagesc, Daniel Arteaga, 2011/12/02
- Re: Non-linear axis data in imagesc, Daniel Arteaga, 2011/12/02