help-octave
[Top][All Lists]
Advanced

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

Re: gnuplot versus matlab plot: a suggestion


From: Søren Hauberg
Subject: Re: gnuplot versus matlab plot: a suggestion
Date: Mon, 16 Jul 2007 12:28:35 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20070604)

address@hidden skrev:
styles = {"+", "*", "o", "x", "r+"};
for i = 1:5
   plot(k, k.^k, styles{k});
endfor


and if i want sth like bellow? I cannot put the names in the graph!

styles = {"+", "*", "o", "x", "r+"};
names ={"a", "b", "c", "d", "e"};
hold on
v = (1:1:10)'
for k = 1:5
     plot( v, v*k , styles{i}; names{i});
endfor
I haven't tested this but I guess you could either do

styles = {"+", "*", "o", "x", "r+"};
names ={"a", "b", "c", "d", "e"};
hold on
v = (1:1:10)'
for k = 1:5
     plot( v, v*k , [styles{i}, ";", names{i}]);
endfor

or add a

legend(names)

after the loop

Søren


reply via email to

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