help-octave
[Top][All Lists]
Advanced

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

Re: problem plotting "N-d object"


From: Sergei Steshenko
Subject: Re: problem plotting "N-d object"
Date: Sun, 19 Feb 2012 01:18:42 -0800 (PST)




----- Original Message -----
> From: Ben Abbott <address@hidden>
> To: CdeMills <address@hidden>
> Cc: address@hidden
> Sent: Sunday, February 19, 2012 1:41 AM
> Subject: Re: problem plotting "N-d object"
> 
> On Feb 18, 2012, at 2:44 PM, CdeMills wrote:
> 
>>  bpabbott wrote
>> 
>>>  I'm not really concerned about buggy code accidentally triggering 
> this
>>>  functionality. At the same time, if such a change is accepted, then it
>>>  needs to be documented and demos should be needed.
>>> 
>>>  I'm not sure a new squeezable N-D array will do the job in a clean 
> way.
>>>  Maybe I'm missing something? Are you thinking of overloading the 
> plot
>>>  function?
>> 
>>  Buggy code should trigger error messages ASAP. 
>> 
>>  Now, I often run simulations and collate 1D and 2D matrices into 3D, where
>>  the third dim is the run number.  Auto-squeezing would be convenient, but I
>>  think we should have a flag to tell plot "I know my data are 3D, but 
> please
>>  squeeze them." This way it is the INTENT to pass 3D data and have a 1D 
> or 2D
>>  plot.
>> 
>>  Regards
>> 
>>  Pascal
> 
> Thats a good idea !
> 
> The plot function already accepts property name/value pairs. Is the syntax 
> below 
> ok ?
> 
>     plot (x, y, "-squeeze")
> 
> Since this feature may not be desired for all lines, the flag should only be 
> applied to the line object proceeding it.
> 
>     plot (x1, y1, "-squeeze", x2, y2, "color", 
> "r")
> 
> This would allow x1 and y1 to be squeezed (if needed) and produce a blue 
> solid 
> line. The second line would not be squeezed and would produce a red solid 
> line.
> 
> Look ok ?
> 
> Ben
> 
> 

I think we've lost track.

To write "-squeeze" takes more effort than just "(:)".

But the root cause of my original Email is that Octave _wrongly_ thinks that 
foo(1,1,:) is an N-d object.

The original testcase:

"
octave:3> foo(1,1,:) = [1 2 3]
foo =

ans(:,:,1) =  1
ans(:,:,2) =  2
ans(:,:,3) =  3

octave:4> plot(foo(1,1,:));
error: transpose not defined for N-d objects
error: called from:
error:   
/home/qemu/AFSWD/20111122/octave-3.4.2/share/octave/3.4.2/m/plot/private/__plt__.m
 at line 179, column 8
error:   
/home/qemu/AFSWD/20111122/octave-3.4.2/share/octave/3.4.2/m/plot/private/__plt__.m
 at line 104, column 17
error:   
/home/qemu/AFSWD/20111122/octave-3.4.2/share/octave/3.4.2/m/plot/plot.m at line 
194, column 9
octave:4> plot(foo(1,1,:)(:));
octave:5>             
".

I insist that in this case foo(1,1,:) is a _one_-d object - because two of the 
three indexes are fixed/constant.

I.e. the plot family of functions tries to do the right thing already, but 
because foo(1,1,:) is _not_ seen by Octave as a 1-d object the functions fail.

Regards,
  Sergei.



>


reply via email to

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