How to multiplot with legend?

Posted 8 years ago
6517 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 groupHow can I add a legend for those two group?Thanks!
3 Replies
Sort By:
Posted 8 years ago
 After run the code, double click on legend and change the position of it.. Attachments:
Posted 8 years ago
 Is this what you need? Attachments:
Posted 8 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?