« Return to Thread: legend on every second data set

Re: legend on every second data set

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View in Thread

On Thu, May 8, 2008 at 9:30 PM, oxy <oxyopes@...> wrote:

> Hi friends,
>  how ca i put a legend on every second curve in a graph?
>
>  octave> plot(x1, y1, '*', x1, fit_y1, '-')
>  octave> hold on
>  octave> plot(x2, y2, '*', x2, fit_y2, '-')
>
>  Now a legend only for (x1, y1) and (x2, y2), and not the fitting curves.
>  Any tip?
>  Thanks in advance ...

What works under Matlab (and probably also under octave) is to
re-order the children to have the children for which you want a
legend first in the children list, then use "legend" command.
This means:

h = get(gca, 'children')
% re-order handles in h
set(gca, 'children', h)
legend('item 1', 'item 2')

Michael.
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

 « Return to Thread: legend on every second data set

LightInTheBox - Buy quality products at wholesale price