From: Le He on 26 Jan 2010 03:12 Hi, I like to plot two groups of lines in the same plot. Each group has two lines with same color and I have to draw them in the order of one group after another group. I try to show legend for groups only not for lines. How can I do this? Here is a simplification of my wrong code: plot(x1, y1, color1); hold on; plot(x2, y2, color1); hold on; plot(x3, y3, color2); hold on; plot(x4, y4, color2); hold on; legend({color1, color2}) Thanks!
From: Husam Aldahiyat on 26 Jan 2010 13:32 Le He <flylehe(a)hotmail.com> wrote in message <1086898179.54627.1264529565883.JavaMail.root(a)gallium.mathforum.org>... > Hi, > > I like to plot two groups of lines in the same plot. Each group has two lines with same color and I have to draw them in the order of one group after another group. I try to show legend for groups only not for lines. How can I do this? Here is a simplification of my wrong code: > > plot(x1, y1, color1); hold on; > plot(x2, y2, color1); hold on; > > plot(x3, y3, color2); hold on; > plot(x4, y4, color2); hold on; > > legend({color1, color2}) > > Thanks! Try doing this: > hold on % once it's on, it remains so > plot(x1, y1, color1); > plot(x3, y3, color2); > plot(x2, y2, color1); > plot(x4, y4, color2); > > legend({color1, color2}) Should work like you want.
|
Pages: 1 Prev: concatenate diagonals Next: clueless in urgent need of HEEEEELP |