MathGroup Archive 1999

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

Search the Archive

RE: Preventing plotting on output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20123] RE: [mg20090] Preventing plotting on output
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Sat, 2 Oct 1999 03:04:52 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Adam Smith wrote:
---------------------------
I want to construct some plots and then display them combined on one graph.
The Plot[] for each individual plot is fairly lengthy and I was hoping to
save some space by replacing the 
"DisplayFunction->Identity" with a single word like "nodisp".  In the final
Show[] I would then turn the display back on with the usual 
"DisplayFunction>$DisplayFunction" (maybe even equate it with a single term
like "disp").

Here is a simplified example of what I quickly tried without success

nodisp = DisplayFunction -> Identity

graph1 = Plot[Sin[2 Pi x],{x,0,2},nodisp]     Error messages show up
graph2 = Plot[Sin[4 Pi x],{x,0,2},nodisp]

Show[{plot1,plot2},DisplayFunction -> $DisplayFunction]

----------------------------
REPLY:

There are a couple of ways to approach this.  First you can download my
PlotFunctions package from:
http://www.mathsource.com/cgi-bin/msitem?0209-876

Then you can load my package (as I show below) and the method you tried will
work!  Besides that my package makes it so you never need to use Evaluate
inside Plot, Plot3D, ParametricPlot, ContourPlot, DensityPlot or Play, and
your plots will always come out right.  Sounds nice doesn't it?


In[1]:=
<<PlotFunctions.m
nodisp=DisplayFunction->Identity;
disp=DisplayFunction:>$DisplayFunction;


In[4]:=
graph1=Plot[Sin[2 Pi x],{x,0,2},nodisp];
graph2=Plot[Sin[4 Pi x],{x,0,2},nodisp];
Show[{graph1,graph2},disp];

(* graphic not shown *)


-------------------------------
Block can also be useful for this sort of thing.  The following is an
example from the discussion of Block on my web site (the URL is given
below). 


In[7]:=
Block[{$DisplayFunction=Identity},
  p1=Plot[Sin[t],{t,0,\[Pi]/2}];
  p2=Plot[Sin[2 t],{t,0,\[Pi]/2}];
  p3=Plot[Sin[3 t],{t,0,\[Pi]/2}];
  p4=Plot[Sin[4 t],{t,0,\[Pi]/2}];
];
Show[GraphicsArray[{{p1,p2},{p3,p4}}],
  ImageSize->{400,260}
];


(* Graphic not shown. *)

---------------------------
I expect Dave Park will use this as a chance to pitch his DrawingPaper
package since it's another way to avoid that damn option DisplayFunction.
You can find Dave's package at
http://home.earthlink.net/~djmp/Mathematica.html


---------------------------
Regards,
Ted Ersek

For Mathematica tips, tricks see 
http://www.dot.net.au/~elisha/ersek/Tricks.html


  • Prev by Date: Re: Re: List-Selection
  • Next by Date: Re: Preventing plotting on output
  • Previous by thread: Re: Preventing plotting on output
  • Next by thread: Re: Preventing plotting on output