[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: legend on every second data set
From: |
Michael Goffioul |
Subject: |
Re: legend on every second data set |
Date: |
Thu, 8 May 2008 22:25:12 +0200 |
On Thu, May 8, 2008 at 9:30 PM, oxy <address@hidden> 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.