legend on every second data set

View: New views
6 Messages — Rating Filter:   Alert me  

legend on every second data set

by oxyopes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 ...
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: legend on every second data set

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Parent Message unknown Re: legend on every second data set

by oxyopes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> plot(x1, y1, '*;legend1', x1, fit_y1, '-')

This does not work for me. Look

octave-3.0.0:13> plot(g1(:,1),g1(:,2), '*;legend 1')
error: plot: properties must appear followed by a value
error: evaluating if command near line 58, column 6
error: evaluating if command near line 57, column 4
error: evaluating if command near line 55, column 2
error: evaluating if command near line 54, column 7
error: evaluating while command near line 41, column 5
error: evaluating if command near line 28, column 3
error: called from `__plt__' in file
`/usr/local/share/octave/3.0.0/m/plot/__plt__.m'
error: evaluating assignment expression near line 187, column 9
error: called from `plot' in file `/usr/local/share/octave/3.0.0/m/plot/plot.m'


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

Re: legend on every second data set

by David Bateman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

oxy wrote:
>> plot(x1, y1, '*;legend1', x1, fit_y1, '-')
>
> This does not work for me. Look
>
> octave-3.0.0:13> plot(g1(:,1),g1(:,2), '*;legend 1')

plot(g1(:,1),g1(:,2), '*;legend 1;')

Note missing ; character in the original command

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

Re: legend on every second data set

by oxyopes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> plot(g1(:,1),g1(:,2), '*;legend 1;')

Perfect, thanks!!!
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: legend on every second data set

by Thomas Ilnseher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Am Montag, den 12.05.2008, 19:35 +0200 schrieb oxy:
> > plot(x1, y1, '*;legend1', x1, fit_y1, '-')
>
> This does not work for me. Look
sorry for teh late reply, i was on vacation with no email access
>
> octave-3.0.0:13> plot(g1(:,1),g1(:,2), '*;legend 1')
you forgot the second semicolon:
plot(g1(:,1),g1(:,2), '*;legend 1')
should be:
plot(g1(:,1),g1(:,2), '*;legend 1;')

> error: plot: properties must appear followed by a value
> error: evaluating if command near line 58, column 6
> error: evaluating if command near line 57, column 4
> error: evaluating if command near line 55, column 2
> error: evaluating if command near line 54, column 7
> error: evaluating while command near line 41, column 5
> error: evaluating if command near line 28, column 3
> error: called from `__plt__' in file
> `/usr/local/share/octave/3.0.0/m/plot/__plt__.m'
> error: evaluating assignment expression near line 187, column 9
> error: called from `plot' in file `/usr/local/share/octave/3.0.0/m/plot/plot.m'
>
>
> Any idea?
--
Thomas Ilnseher <ilnseher@...>

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