Re: A question concerning Show and PlotLegend
- To: mathgroup at smc.vnet.net
- Subject: [mg65293] Re: A question concerning Show and PlotLegend
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 24 Mar 2006 00:59:52 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 3/23/06 at 6:58 AM, rbnorman at WPI.EDU (Ryan Bradley Norman) wrote: >What I was hoping was that the command PlotRange -> PlotRange[p2]] >does is set the PlotRange for the Show to that of p2- which is the >plot of the data points. If you remove the variables for the >legend, the plot does what it is supposed to do- shows the >theoretical curves and the data on one plot. Well, it actually >outputs two plots. One with just the curves and below it one with >the curves and the data plotted together. But when the variables >used to set the legend are included it messes everything up. >Just to be clear, p2 is a plot of some data points using >MultipleListPlot and I am trying to add two theoretical curves to >the plot. Does the following produce something like what you are looking for? In[26]:= SeedRandom[0] In[27]:= data = Sort[Table[Random[], {10}]]; lin = a*x + b /. FindFit[data, a*x + b, {a, b}, x]; par = a*x^2 + b*x + c /. FindFit[data, a*x^2 + b*x + c, {a, b, c}, x]; In[30]:= Show[Block[{$DisplayFunction = Identity}, {ListPlot[data], Plot[lin, {x, 1, 10}, PlotStyle -> Blue], Plot[par, {x, 1, 10}, PlotStyle -> Red]}], PlotRange -> {Automatic, {-0.1, 1.1}}, Frame -> True, Axes -> None, Epilog -> {Text["linear fit", {0.5, 1}, {-1, 0}], Text["parabolic fit", {0.5, 0.92}, {-1, 0}], Red, Line[{{0, 0.92}, {0.5, 0.92}}], Blue, Line[{{0, 1}, {0.5, 1}}]}]; -- To reply via email subtract one hundred and four