Message Boards Message Boards

GROUPS:

How to multiplot with legend?

Posted 3 years ago
3394 Views
|
3 Replies
|
0 Total Likes
|

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
Answer
3 Replies
Posted 3 years ago

Is this what you need?

Attachments:
Posted 3 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
Answer
Posted 3 years ago

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

Attachments:
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