MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: A question concerning Show and PlotLegend

  • To: mathgroup at
  • Subject: [mg65289] Re: [mg65270] Re: [mg65255] A question concerning Show and PlotLegend
  • From: ggroup at
  • Date: Fri, 24 Mar 2006 00:59:46 -0500 (EST)
  • References: <> <000e01c64dce$4681ef00$4001a8c0@Aristophanes> <>
  • Sender: owner-wri-mathgroup at

On Thu, 23 Mar 2006 06:58:29 -0500 (EST), 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 I remember correctly, Show will use the Options of the first graphics 
object given.  So you might get away with something like:
Show[p2, Plot[...]]

> 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.  

Use DisplayTogether from the Graphics` package.  It will suppress the extra 

> 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.

Well, if you're using MultipleListPlot anyway, you'll probably find it MUCH 
easier to simply create tables for your functions and plot them along with 
your data in one MultipleListPlot.  For example:

data = Table[{x, 10 Sin[x] + Random[]}, {x, 0, 6, .25}];
func1[x_] := {x, 9 Sin[x]}
func2[x_] := {x, 11 Cos[x - 1.5]}
f1dat = func1 /@ data[[All, 1]];
f2dat = func2 /@ data[[All, 1]];
MultipleListPlot[data, f1dat, f2dat, PlotJoined -> {False, True, True},
 SymbolShape -> {PlotSymbol[Triangle], None, None},
  PlotStyle -> {{GrayLevel[0.]}, {Red}, {Blue}},
  PlotLegend -> {"Data", "func1", "func2"}];

Otherwise, I think you'll need to use ShowLegend[], and create your own 
legends from scratch.

  • Prev by Date: New fractal based on the Golden mean/ Fibonacci numbers
  • Next by Date: Re: Re: sorting list of roots af a transcendental function
  • Previous by thread: Re: A question concerning Show and PlotLegend
  • Next by thread: Re: A question concerning Show and PlotLegend