AW: LogPlot/Plot-Identity

*To*: mathgroup at smc.vnet.net*Subject*: [mg27115] AW: [mg27041] LogPlot/Plot-Identity*From*: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.de>*Date*: Sun, 4 Feb 2001 02:58:49 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

-----Ursprüngliche Nachricht----- Von: bernd at bio.vu.nl [mailto:bernd at bio.vu.nl] Gesendet: Donnerstag, 1. Februar 2001 09:00 An: mathgroup at smc.vnet.net Betreff: [mg27041] LogPlot/Plot-Identity Dear group, I am trying to plot several plots in one. This poses no diffuculties. But LogPlot seems to behave differently with regard to $DisplayFunction. I have a simple example: Show[Block[{$DisplayFunction = Identity}, Plot[Exp[3 t], {t, 0, 5}]]] This just shows the graphic. However, in Show[Block[{$DisplayFunction = Identity}, LogPlot[Exp[3 t], {t, 0, 5}]]] The $DisplayFunction remains Identity even with Show, thus no plot is produced in case of LogPlot. Can someone explain this difference between Plot and LogPlot? Regards, Bernd Dear Bernd, although this is folklore recommended procedure, it has to be regarded with suspicion. You have to look at what you get: g1 = Block[{$DisplayFunction = Identity}, Plot[Exp[3 t], {t, 0, 5}]] Options[g1, DisplayFunction] {DisplayFunction :> $DisplayFunction} So here in the result all is fine, when you execute Show[g1] you'll use the value of $Display function in the execution environment of Show. But for g2 = Block[{$DisplayFunction = Identity}, LogPlot[Exp[3 t], {t, 0, 5}]] Options[g2, DisplayFunction] {DisplayFunction -> Identity, DisplayFunction :> Identity} You see that the temporary value of $DisplayFunction of Block has been smuggled into the graphics object. I cannot tell this a bug of LogPlot (and similar routines, and if you write your own plotting routines you'll find out it's not easy to prevent all references to the unevaluated $DislayFunction). This here (is a more correct alternative, I think): g2a = Block[{$DisplayFunction}, Identity @@ LogPlot[Exp[3 t], {t, 0, 5}]] This construct keeps all references to $DisplayFunction as unevaluated, and applying Identity to the final result prevents the display. Options[g2a, DisplayFunction] {DisplayFunction -> (Display[$Display, #1] &), DisplayFunction :> Identity} Show[g2a] It's interesting to compare that with straight plotting: g2x = LogPlot[Exp[3 t], {t, 0, 5}] Options[g2x, DisplayFunction] {DisplayFunction -> (Display[$Display, #1] &), DisplayFunction :> Identity} So we had got the same, the right say, graphics object! (witout displaying it) -- Hartmut Wolf