Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Making multiple plots




L. Sartre wrote:

> I would like to show two plots on a same graphics output but separatly.
> For this, I do as follows:
>
> curve1 := Plot[Sin[t x], {x, -Pi, Pi}, PlotRange -> {-Pi,Pi}, {-1, 1}}];
>  curve2 := Plot[Cos[t x], {x, -Pi, Pi}, PlotRange -> {-Pi,Pi}, {-1,
> 1}}];
> curve:=Graphics[{Rectangle[Scaled[{0,0}],Scaled[{0.5,1}],courbe1],Rectangle[
> Scaled[{0.5,0}],Scaled[{1,1}],courbe2]}]; Show[Graphics[courbe]]
>
> Then I get three plots. I am interested in getting only the third one.
> Does anyone has any suggestion ?

Here is variant of your code.Display is turned off by setting
DisplayFunction -> Identity and is turned on by setting DisplayFunction
-> $DisplayFunction
In this case you do not need to specify the plot range, but it is a good
precaution if you want to display all the plot, and here it can be done
by PlotRange -> All.

(1)
curve1 := Plot[Sin[2 x], {x, -Pi, Pi}, PlotRange -> All,
 DisplayFunction -> Identity];

 curve2 :=
  Plot[Cos[3 x], {x, -Pi, Pi}, PlotRange -> All, DisplayFunction ->
Identity];

curve:=
 Graphics[
  {Rectangle[Scaled[{0,0}],Scaled[{0.5,1}],curve1],
   Rectangle[Scaled[{0.5,0}],Scaled[{1,1}],curve2]
  }
 ];

 Show[curve,   (*Graphics wrapper not needed*)
 DisplayFunction -> $DisplayFunction ];

(2) You may find GraphicsArray useful


Show[GraphicsArray[{curve1,curve2},Frame->True ]];

Graphics array automatically sets DisplayFunction -> $DisplayFunction

(3) The display can be programmed very compactly

Show[ Block[{$DisplayFunction = Identity}, GraphicsArray[
   {Plot[Sin[2 x], {x, -Pi, Pi}, PlotRange-> All],
    Plot[Cos[3x], {x, -Pi, Pi}, PlotRange ->All]
   }]], Frame->True];

or

Show[ Block[{$DisplayFunction = Identity}, GraphicsArray[
   Plot[#,{x, -Pi, Pi}, PlotRange-> All]&/@{Sin[2x],Cos[3x]} ]],
Frame->True];


--
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642





  • Prev by Date: MathLink with Win95
  • Next by Date: Re: Celestial Mechanics
  • Prev by thread: Re: Making multiple plots
  • Next by thread: Re: Making multiple plots