octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with 'xlim' property


From: Ben Abbott
Subject: Re: Help with 'xlim' property
Date: Mon, 22 Jun 2015 20:02:17 -0400

> On Jun 22, 2015, at 7:36 PM, Michael Godfrey <address@hidden> wrote:
> 
> On 06/23/2015 12:21 AM, Rik wrote:
>> 6/22/15
>> 
>> I don't think Octave is properly validating the 'xlim', 'ylim', etc.
>> properties.  It seems to accept any matrix value at all instead of just a
>> 2-element row vector.  It's easy enough to change, but I'm hoping someone
>> can verify in Matlab what the following code does.
>> 
>> plot (1:10)
>> set (gca, 'xlim', [1 3 5; 2 4 6])
>> set (gca, 'xlim', [1 2 4])
>> set (gca, 'xlim', [1 5]')
>> set (gca, 'xlim', [1 8])
>> 
>> I would expect errors out of everything but the last.
>> 
>> Thanks,
>> Rik
>> 
> 
> Here is from Matlab 2015a:
> 
> >> plot (1:10)
> >> set (gca, 'xlim', [1 3 5; 2 4 6])
> Error using matlab.graphics.axis.Axes/set
> While setting the 'XLim' property of 'Axes':
> Value must be a 1x2 vector of numeric type in which the second element is 
> larger than the first and may be
> Inf
>  
> >> set (gca, 'xlim', [1 2 4])
> Error using matlab.graphics.axis.Axes/set
> While setting the 'XLim' property of 'Axes':
> Value must be a 1x2 vector of numeric type in which the second element is 
> larger than the first and may be
> Inf
>  
> >> set (gca, 'xlim', [1 5]')
> >> set (gca, 'xlim', [1 8])
> >> 
> Not quite your expectation. Matlab has many surprises... :-) 

Hi Rik,

R2014a was the last version of Matlab before a massive rewrite. The newer 
versions rely more heavily on object orientation, and (imo) barely qualify as 
compatible with R2014a. I expect we’ll soon see bug reports against 2014a 
compatible code. However, in this instance all is essentially the same.

Using R2014a ...

plot (1:10)
set (gca, 'xlim', [1 3 5; 2 4 6])

Error using set
Bad property value found.
Object Name: axes
Property Name: 'XLim'
Value must be a 2 element vector.
 
set (gca, 'xlim', [1 2 4])

Error using set
Bad property value found.
Object Name: axes
Property Name: 'XLim'
Value must be a 2 element vector.
 
set (gca, 'xlim', [1 5]')
set (gca, 'xlim', [1 8])

Ben





reply via email to

[Prev in Thread] Current Thread [Next in Thread]