Re: PlotLegend and Show
- To: mathgroup at smc.vnet.net
- Subject: [mg117947] Re: PlotLegend and Show
- From: Alexei Boulbitch <alexei.boulbitch at iee.lu>
- Date: Tue, 5 Apr 2011 06:44:07 -0400 (EDT)
Isn't it Needs["PlotLegends`"]; p1 = Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, PlotLegend -> {"sine", "cosine"}]; p2 = Plot[{Sin[x + \[Pi]], Cos[x + \[Pi]]}, {x, 0, 2 Pi}, PlotLegend -> {"sine", "cosine"}]; Show[{p1, p2}] or Needs["PlotLegends`"]; Plot[{Sin[x], Cos[x], Sin[x + \[Pi]], Cos[x + \[Pi]]}, {x, 0, 2 Pi}, PlotLegend -> {"sine", "cosine", "sin\[Pi]", "cos\[Pi]"}] ?? Have made a plot which uses PlotLegend. Would like to combine this plot with another plot. Tried using Show[] to do this, but the results were not not what I expected. In the combined plot, the second plot doesn't have the same scale as the first plot. When I remove the PlotLegend option from the first plot and use show to combine the two plots all is well. Below is an example. (Though in the case I would like to run, there are about 10 different graphs in the first plot, so making the legend by hand would be time consuming.) Recommendations? Thanks. (* this isn't what I want *) p1 = Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, PlotLegend -> {"sine", "cosine"}] p2 = Plot[{Sin[x + \[Pi]], Cos[x + \[Pi]]}, {x, 0, 2 Pi}] Show[p1, p2] (* remove the legend and all is well *) p1 = Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi} ] p2 = Plot[{Sin[x + \[Pi]], Cos[x + \[Pi]]}, {x, 0, 2 Pi}] Show[p1, p2] -- Alexei Boulbitch, Dr. habil. Senior Scientist Material Development IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 CONTERN Luxembourg Tel: +352 2454 2566 Fax: +352 2454 3566 Mobile: +49 (0) 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu www.iee.lu -- This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.