Re: Re: Suppressing display of LogPlots
- To: mathgroup at smc.vnet.net
- Subject: [mg22649] Re: [mg22614] Re: Suppressing display of LogPlots
- From: Hartmut Wolf <hwolf at debis.com>
- Date: Thu, 16 Mar 2000 09:11:07 -0500 (EST)
- Organization: debis Systemhaus
- References: <8aejj2$3aj@smc.vnet.net> <200003150346.WAA01854@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dr Dan,
dear Allan,
if you observe
In[11]:= << "Graphics`Graphics`"
In[12]:= g2 = LogLinearPlot[Sin[x], {x, 0, 3*Pi}]
-- Graphics deleted --
Out[12]= Graphics[]
In[13]:= Cases[g2, _[DisplayFunction, _], -1]
Out[13]= {DisplayFunction -> (Display[$Display, #1] & ),
DisplayFunction :> Identity}
You'll see that second ominous DisplayFunction :> Identity, and the
first Option DisplayFunction -> (Display[$Display, #1] & ) that reflects
the value of the $DisplayFunction global variable at the time of the
execution of In[12].
If you follow standard procedures to create the Graphics with Plot but
without showing you'll get
In[14]:= g2a = LogLinearPlot[Sin[x], {x, 0, 3*Pi},
DisplayFunction -> Identity]
Out[14]= Graphics[]
In[15]:= Cases[g2a, _[DisplayFunction, _], -1]
Out[15]= {DisplayFunction -> Identity, DisplayFunction :>
Identity}
In[16]:= Show[g2a, DisplayFunction -> $DisplayFunction]
-- Graphics deleted --
Out[16]= Graphics[]
In[17]:= Cases[%, _[DisplayFunction, _], -1]
Out[17]= {DisplayFunction -> (Display[$Display, #1] & ),
DisplayFunction :> Identity}
Compare this with the built-in
In[20]:= g1 = Plot[Sin[x], {x, 0, 3*Pi}, DisplayFunction ->
Identity]
Out[20]= Graphics[]
In[21]:= Cases[g1, _[DisplayFunction, _], -1]
Out[21]= {DisplayFunction :> Identity}
In[22]:= Show[g1, DisplayFunction -> $DisplayFunction]
-- Graphics deleted --
Out[22]= Graphics[]
In[23]:= Cases[%, _[DisplayFunction, _], -1]
Out[23]= {DisplayFunction -> (Display[$Display, #1] & ),
DisplayFunction :> Identity}
So I see no point in neither changing the packages, nor cleaning up.
Block-ing the global variables is risky anyways, doing so might be a
handy trick, but if something goes wrong, than the trick is the bug;
exempli causa:
In[24]:= Block[{$DisplayFunction},
g2x = LogLinearPlot[Sin[x], {x, 0, 3*Pi}]; ]
In[25]:= g2x
-- believe it or not, Graphics was here --
Out[182]= Graphics[]
In[26]:= Cases[g2x, _[DisplayFunction, _], -1]
-- again, Graphics was here --
Out[183]= {DisplayFunction -> (Display[$Display, #1] & ),
DisplayFunction :> Identity}
Let's finally compare
In[27]:= g2 === g2x
-- again, Graphics was here (once only!) --
Out[27]= True
So not all is perceptible to us!
Kind regards, Hartmut
- References:
- Re: Suppressing display of LogPlots
- From: "Allan Hayes" <hay@haystack.demon.co.uk>
- Re: Suppressing display of LogPlots