help-octave
[Top][All Lists]
Advanced

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

Re: Help - linestyleorder in chart


From: Nicholas Jankowski
Subject: Re: Help - linestyleorder in chart
Date: Fri, 20 Nov 2015 12:23:48 -0500

On Fri, Nov 20, 2015 at 11:55 AM, Ivo Vinklárek <address@hidden> wrote:

2015-11-20 16:22 GMT+01:00 Nicholas Jankowski <address@hidden>:

On Fri, Nov 20, 2015 at 9:10 AM, Ivo Vinklárek <address@hidden> wrote:
Hello,

I have a problem with oder of lines in chart.
When I write code
[a]=plot(x , y1, '+', 'markersize', 10, x, y2, 'linewidth', 4),
I would expect that the data with marker '+' will be on the bottom and data with '-' will be on the top, but it is the opposite. I tried to change order in skript and etc. to change it, but I nothing changed it.

Could you help me, please, how to change order? 

Thanks
Ivo


Just as the examples in the help for the plot command show, the normal behavior is for the first specified dataset to be first in the list, starting from the top of the legend.  i.e., the help example:

>> t = 0:0.1:6.3;
>> plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");

puts the cos(t) function first at the top of the list.  

if you want them in a reverse order, i believe you need to specify them in that order.

nickj



>
>Hi,
>
>it used to be that way... But now in Octave 4 they changed it to different behavior. So
>now... if you put a plot with line mark('-')... it always put it in the back, behind the plots with
>different marks (like '+' or 's' and etc.). I don't know if it is bug, or it can be changed...
>
>that means that now it is the same when you write
>[a]=plot(x , y1, '+', 'markersize', 10, x, y2, 'linewidth', 4) or [a]=plot(x, y2, 'linewidth', 4, x ,
>y1, '+', 'markersize', 10)
>
>and that's the problem....
>
>Ivo

Please use Reply all to keep the help list in the email chain so others can chime in if necessary, also add your reply to the end of the email as that's the convention on the list to make it easier for people to follow the thread. 

Anyway, I think I had misinterpreted you initial question to just having to do with the order of the data, as you'd see in a legend. What you actually mean is whether one set of data would 'hide' another one. Hence the thick line hiding the marker.

Just to make sure I'm seeing it the same way you are:  It wasn't as obvious with the blue and green, so I ran the following test code with red and yellow:

>> x = 0:0.1:20;
>> y1 = sin(x); y2 = cos(x);
>> plot(x , y1, 'r+', 'markersize', 10, x, y2, 'y', 'linewidth', 4);legend('y1','y2');
>> figure;
>> plot(x, y2, 'y', 'linewidth', 4, x , y1, 'r+', 'markersize', 10);legend('y2','y1');

What I see is that in the first plot, the cosine function starting at 1 is in a solid yellow line, the sine function is in red pluses, and where they overlap I see the red plus over top of the green line. (so the line is not obscuring the pluses). this is as I'd expect.

In the second plot, the sine function starting at 0 is first in a solid yellow line, the cosine function is second in red +, and where they overlap I again see the red plus over top of the yellow line. I guess this is what you mean by the layer order not following the plot order.

With green and blue it looked to me at first like it had followed that plot order, but only of the colors used.

I believe Octave 4.0 was the first to use the QT graphics toolkit by default. switching to others, it seems that QT is the only toolkit that behaves this way.  Maybe someone else can comment on whether this is a known issue, considered a bug or not.

In the meantime, you can get your expected behavior back by switching to fltk or gnuplot using:

graphics_toolkit('fltk') or graphics_toolkit('gnuplot')

Nick J.

reply via email to

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