MathGroup Archive 1999

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

Search the Archive

Re: Preventing plotting on output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20120] Re: Preventing plotting on output
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 2 Oct 1999 03:04:51 -0400
  • References: <7suv5r$21s@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Adam,
The problem is that Plot has the attribute HoldAll, so inspects the
unevaluated nodisp, finds that it is not an option or a  nested list of
options.
We have to get nodisp to evaluate before the inspection. Thus

nodisp = DisplayFunction -> Identity;
graph1 = Plot[Sin[2 Pi x], {x, 0, 2}, Evaluate[nodisp]]

But this does spoil the brevity a bit..

Alternative ways ( besides using SetOptions) are illustrated by

(1)
Block[{$DisplayFunction = Identity},
     {Plot[Sin[3 Pi x], {x, 0, 2}],
      Plot[Sin[ 4Pi x], {x, 0, 2}]}
    ] // Show

and

(2)
<< Graphics`Graphics`

DisplayTogether[
    Plot[Sin[3 Pi x], {x, 0, 2}],
    Plot[Sin[ 4Pi x], {x, 0, 2}]]

(3) (Global version of (1))

Turn off all displays

     dsf = $DisplayFunction
     $DisplayFunction = Identity

    gr1 = Plot[Sin[3 Pi x], {x, 0, 2}];
    gr2 = Plot[Sin[4Pi x], {x, 0, 2}];

Restore $DisplayFunction

     $DisplayFunction = dsf

Show graphics

    Show[gr1, gr2]
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565



<adam.smith at hillsdale.edu> wrote in message news:7suv5r$21s at smc.vnet.net...
> I know I could find the answer to this if I looked hard enough through
> the Help and/or Manual, but I am certain one of the experts out there
> will have the solution immediately.
>
> 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]
>
> I realize I could use SetOptions[] to temporarily turn off and turn on
> display, but defining nodisp seems more natural and intuitive to me.
>
> Adam Smith
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>



  • Prev by Date: Re: Preventing plotting on output
  • Next by Date: Trouble with () in Graphics text in WindowsNT
  • Previous by thread: Re: Preventing plotting on output
  • Next by thread: Re: Preventing plotting on output