
From:  Nicholas Jankowski 
Subject:  RE: Cant do simple XY plot 
Date:  Mon, 9 Nov 2015 20:04:56 0500 
On Nov 9, 2015 6:14 PM, "Dekome, Kent F. (JSCER611)" <address@hidden> wrote:
>
> ________________________________
>
>
>
> From: address@hidden [mailto:address@hidden] On Behalf Of Nicholas Jankowski
> Sent: Monday, November 09, 2015 4:26 PM
>
> To: Dekome, Kent F. (JSCER611)
> Cc: Help GNU Octave
> Subject: Re: Cant do simple XY plot
>
>
>
> On Mon, Nov 9, 2015 at 4:10 PM, Dekome, Kent F. (JSCER611) <address@hidden> wrote:
>>
>>
>>
>>
>>
>> From: address@hidden [mailto:address@hidden] On Behalf Of Nicholas Jankowski
>> Sent: Monday, November 09, 2015 2:37 PM
>> To: Dekome, Kent F. (JSCER611)
>> Cc: Help GNU Octave
>>
>>
>> Subject: Re: Cant do simple XY plot
>>
>>
>>
>> On Mon, Nov 9, 2015 at 3:22 PM, Dekome, Kent F. (JSCER611) <address@hidden> wrote:
>>>
>>>
>>>
>>>
>>>
>>> From: address@hidden [mailto:address@hidden] On Behalf Of Nicholas Jankowski
>>> Sent: Monday, November 09, 2015 1:33 PM
>>> To: Help GNU Octave; Dekome, Kent F. (JSCER611)
>>> Subject: Fwd: Cant do simple XY plot
>>>
>>>
>>>
>>> Original Message
>>> From: address@hidden [mailto:address@hidden] On Behalf Of Nicholas Jankowski
>>> Sent: Monday, November 09, 2015 12:40 PM
>>> To: Dekome, Kent F. (JSCER611)
>>> Cc: address@hidden
>>> Subject: Re: Cant do simple XY plot
>>>
>>>
>>>
>>> On Mon, Nov 9, 2015 at 12:11 PM, Dekome, Kent F. (JSCER611) <address@hidden> wrote:
>>>
>>> > Installed the 4.0.0.0 on Windows 7 to test its ability to handle
>>>
>>> > Matlab mat files...
>>>
>>> >
>>>
>>> > Loaded my test file and all data vectors are showing up, yet when I
>>>
>>> > try to do a simple XY plot the figure window remains blank…
>>>
>>> >
>>>
>>> >
>>>
>>> >
>>>
>>> > I can plot the X and Y vector independently, but nothing happens when I do:
>>>
>>> >
>>>
>>> >
>>>
>>> >
>>>
>>> > plot( HERA_TLM_T_EngineeringData_TIMETAG,
>>>
>>> > HERA_TLM_T_EngineeringData_LastiLoadID)
>>>
>>> >
>>>
>>> >
>>>
>>> >
>>>
>>> > I also tried wrapping the last vector with “double” since it is loaded
>>>
>>> > as “int16”…same result. Both these vectors are 102 x 1…
>>>
>>> >
>>>
>>> >
>>>
>>> >
>>>
>>> > plot( HERA_TLM_T_EngineeringData_TIMETAG,
>>>
>>> > double(HERA_TLM_T_EngineeringData_LastiLoadID))
>>>
>>> >
>>>
>>> >
>>>
>>> >
>>>
>>> > Whats the probably obvious problem?
>>>
>>> >
>>>
>>> >
>>>
>>>
>>>
>>> Can you share a sample of the data as it looks after loading into Octave?
>>>
>>>
>>>
>>>  Forwarded message 
>>> From: Dekome, Kent F. (JSCER611) <address@hidden>
>>> Date: Mon, Nov 9, 2015 at 1:45 PM
>>> Subject: RE: Cant do simple XY plot
>>> To: Nicholas Jankowski <address@hidden>
>>>
>>> Actually, here’s the plotting of the two vectors, I’m not sure why the first is displaying as it is, instead of a ramp…its actually already been converted to “datenum” by the generating app…
>>>
>>>
>>>
>>> Autoscale has no effect…
>>>
>>>
>>>
>>>
>>>
>>> <snipped graphic showing time vector is array of 7.3628e5... numbers from datenum)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Thanks for the detail Kent. Try to keep the mailing list in the conversation, and reply at the end to make it easier for others to follow the thread. Including your message and screenshots above.
>>>
>>> Pretty sure your first graph is due to the timestamp magnitude. try generating an alternative x vector, one in seconds or a relative time.
>>>
>>> >> newtimevector = HERA_TLM_T_EngineeringData_TIMETAG  now
>>>
>>> The little script below shows the difference:
>>>
>>> 
>>>
>>> xvec = zeros(1,10000);
>>>
>>> for idx1 = 1:10000
>>>
>>> xvec(idx1) = now;
>>>
>>> for idx2 = 1:100
>>>
>>> idx1+idx2; %(time delay loop)
>>>
>>> endfor
>>>
>>> endfor
>>>
>>> plot(xvec);
>>>
>>> figure
>>>
>>> plot(xvecnow);
>>>
>>> 
>>>
>>>
>>>
>>> At first I thought it might have to do with data numbersize limits (single precision vs double) but I think the plot routine is just trying to maintain an absolute scaling for both x and y axes including 0, which makes the time vector look like a flat line when plotted alone, and all the data crowds together at the right limit for x,y data:
>>>
>>> 
>>>
>>> figure
>>>
>>> plot(xvec, sin(xvec))
>>>
>>> figure
>>>
>>> plot(xvecnow,sin(xvec))
>>>
>>> 
>>>
>>> Do you have access to compare this to Matlab output for similar datasets? It may be that Octave's current plotting routines need some tweaking.
>>>
>>> Nick J.
>>>
>>>
>>>
>>> ________________________________
>>>
>>> Works in Matlab 2010b…
>>>
>>> If I do :
>>>
>>> >>
>>>
>>> >> A = HERA_TLM_T_EngineeringData_TIMETAG;
>>>
>>> >> B = A  min(A);
>>>
>>> >> plot( B, HERA_TLM_T_EngineeringData_LastiLoadID)
>>>
>>> >>
>>>
>>> I get :
>>>
>>> This appears correct…so how do I get that Matlab output using Octave?
>>>
>>>
>>
>>
>>
>> Again, please Reply All so it keeps the Octave helplist in the loop. Especially for cases like now where I may need someone else to chime in with a suggestion.
>>
>> It's not perfect, but I think manually changing the axes should do it.
>>
>> For the script I used above, something like:
>>
>> >> axis([min(xvec) max(xvec) min(sin(xvec)) max(sin(xvec))]);
>>
>> will give axes that cover your min and max range, without including the zero. Also, if you want code that works in both Matlab and Octave, I don't think that command will cause any problems.
>>
>>
>>
>> Actually, I just found out by accident that hitting 'a' when the figure window is active autoscaled the axes to minmax values for both x and y. So there's that.
>>
>>
>>
>> Maybe someone else from the list can comment on whether the default axes spanning [0 max(vector)] is an intentional thing?
>>
>> Nick J.
>>
>> ________________________________
>>
>>
>>
>> More issues…when I try using axis I did:
>>
>>
>>
>> >> C = HERA_TLM_T_EngineeringData_LastiLoadID;
>>
>> >> min(A)
>>
>> ans = 736264.408391204
>>
>> >> max(A)
>>
>> ans = 736264.414247685
>>
>> >> min(C)
>>
>> ans = 0
>>
>> >> max(C)
>>
>> ans = 21
>>
>> >> axis([min(A) max(A) min(C) max(C)])
>>
>> error: axis: limits(1) must be less than limits(2)
>>
>> error: called from
>>
>> axis>__axis__ at line 295 column 9
>>
>> axis at line 149 column 7
>>
>> >> axis
>>
>> ans =
>>
>>
>>
>> 0 1 0 1
>>
>>
>>
>> >>
>>
>>
>>
>>
>>
>> max(A) is clearly more than min(A), yet if I do:
>>
>>
>>
>> >> C = double(HERA_TLM_T_EngineeringData_LastiLoadID);
>>
>> >> axis([min(A) max(A) min(C) max(C)])
>>
>> >> axis
>>
>> ans =
>>
>>
>>
>> Columns 1 through 3:
>>
>>
>>
>> 7.36264408391204e+005 7.36264414247685e+005 0.00000000000000e+000
>>
>>
>>
>> Column 4:
>>
>>
>>
>> 2.10000000000000e+001
>>
>>
>>
>> >> plot( A, HERA_TLM_T_EngineeringData_LastiLoadID)
>>
>> >
>>
>>
>>
>> That double() call corrects the axis() issue but the plot() call still fails as before…if I do
>>
>>
>>
>> >> plot( A, C)
>>
>> >>
>>
>>
>>
>> Where C is the double version of HERA_TLM_T_EngineeringData_LastiLoadID it STILL fails as before…
>>
>>
>>
>>
>>
>> It should be noted that the graphics is handled by QtHandles here, whereas below I include an email snippet from an officemate using an older version of Octave, on Linux VM, which uses GNUPLOT instead…
>>
>>
>>
>> A=HERA_TLM_T_ScienceData_TIMETAG;
>> B=HERA_TLM_T_EngineeringData_LastConfigID;
>> B_=double(HERA_TLM_T_EngineeringData_LastConfigID);
>>
>> If I tried to plot (A,B), the range came up OK, but the graph was blank. If instead I did plot(A,B_), then it looked just fine. Not sure why it was not automatically promoting the "B" value to be a double (i.e. "B_") mattered to the plot statement, but that was all I had to change to get it to work.
>>
>>
>>
>> Robert
>>
>> P.S. I am using version 3.4.3 under linux (which used gnuplot, instead of Qt)
>>
>>
>>
>>
>>
>> Think I’ll try the Linux version instead…
>>
>>
>>
>>
>
>
>
> you could try switching the graphics toolkit in the windows version to see if you get the same results:
>
> since the Windows version is pretty standard, you can use
>
> available_graphics_toolkits
>
> to show the options. you should have:
> >> available_graphics_toolkits
> ans =
> {
> [1,1] = fltk
> [1,2] = gnuplot
> [1,3] = qt
> }
>
> so then
> >> graphics_toolkit('gnuplot');
>
> will switch to that.
>
> ________________________________
>
>
>
> Hallelujah! That seems to work…
>
Ok, glad we figured that out. Again, if you want this compatible with both programs I believe there is a code snippet on the wiki or manual that works as an 'if octave do x'. I'll post the link if I come across it or maybe someone else can chime in.
Also, seems like the default axis behavior qualifies as a compatibility bug. If I get a chance with MATLAB I'll try to work up a compatibility test and submit a bug report.
Nick J
[Prev in Thread]  Current Thread  [Next in Thread] 