Message Boards Message Boards

0
|
7158 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to multiplot with legend?

Posted 9 years ago

I need to plot different expression in one figure and it need a legend. What I am doing is

p1 = Plot[(x^2+1=0), {x, 0,1}, PlotStyle -> {Cyan, Dashed, Thin}];
p2 = Plot[(y^2+y+2=0), {y, 1,2}, PlotStyle -> {Cyan, Dashed, Thin}];
p3 = Plot[(z^2+5=0), {z, 2,3}, PlotStyle -> {Cyan, Dashed, Thin}];

p4 = Plot[(x^2+8=0), {x, 0,1}, PlotStyle -> {Cyan, Dashed, Thin}];
p5 = Plot[(y^2+y+9=0), {y, 1,2}, PlotStyle -> {Cyan, Dashed, Thin}];
p6 = Plot[(z^2+10=0), {z, 2,3}, PlotStyle -> {Cyan, Dashed, Thin}];

Show[p1,p2,p3,p4,p5,p6, PlotRange -> All]

Where p1,p2 and p3 are for one group and p4,p5 and p6 are for another group

How can I add a legend for those two group?

Thanks!

POSTED BY: Jie Li
3 Replies
Posted 9 years ago

After run the code, double click on legend and change the position of it..

Attachments:
POSTED BY: Okkes Dulgerci
Posted 9 years ago

Is this what you need?

Attachments:
POSTED BY: Okkes Dulgerci
Posted 9 years ago

Thank you, it works. I tried it before but somehow it was not work. Do you know how to add unit to axis label like (x (m/s)) and also how can I put the legend inside the figure?

POSTED BY: Jie Li
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract