[Date Index]
[Thread Index]
[Author Index]
Re: plot function
*To*: mathgroup at smc.vnet.net
*Subject*: [mg130307] Re: plot function
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Tue, 2 Apr 2013 03:26:28 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-newout@smc.vnet.net
*Delivered-to*: mathgroup-newsend@smc.vnet.net
On 4/1/13 at 1:00 AM, johnandsara2 at cox.net (debguy) wrote:
>I can't agree. A semicolon after plot should not stop Show. Below
>is straight from the book which i'm sure you've already tried
>looking up right ? :)
>plot1 = Plot[Sin[x], {x, 0, 2 \[Pi]}, DisplayFunction -> Identity];
>Evaluate the cell to create the graphic.
>plot2 = Plot[Sin[2 x], {x, 0, 2 \[Pi]}, DisplayFunction ->
>Identity];
>"You can see both graphs together by setting the Show option
>DisplayFunction to $DisplayFunction. Evaluate the expression to see
>the graphic."
>Show[plot1, plot2, DisplayFunction -> $DisplayFunction];
Notice
In[1]:= $DisplayFunction
Out[1]= Identity
So,
plot1 = Plot[Sin[x], {x, 0, 2 \[Pi]}, DisplayFunction -> Identity];
is identical to
plot1 = Plot[Sin[x], {x, 0, 2 \[Pi]}];
Usage of DisplayFunction in this manner to combine plots went
away in version 6 when display of plots ceased to be a side
effect. So, with the current version of Mathematica
Show[plot1, plot2, DisplayFunction -> $DisplayFunction];
is the same as
Show[plot1, plot2];
which will be interpreted by Mathematica as the compound expression
Show[plot1, plot2];Null
And since Mathematica will only display the result of the last
portion of a compound expression, no display results.
Also, if you have the default syntax coloring set you will
notice the final semicolon in both
Show[plot1, plot2, DisplayFunction -> $DisplayFunction];
and
Show[plot1, plot2];
is colored red warning you the result may not be as you expect.
If you copied your example from a hard copy version of the
Mathematica Book, you should be aware the last printed version
of that book distributed by Wolfram for Mathematica was for
version 4. The substantial changes between version 5 and 6 mean
a lot of the graphics examples in the last printed version of
the Mathematica book are simply not applicable to the current
version of Mathematica.
If you copied your example from the online book in version 6 or
later, then you found something in the online documentation that
Wolfram failed to update.
Appending a semicolon to the end of Show[...] should suppress
the display. Anything else would mean Show would behave in a
manner inconsistent with all other functions in Mathematica.
The only function that will produce a display when terminated
with a semicolon is Print. And this is because Print sends its
output to $Output rather the Out stack.
Prev by Date:
**Re: NDSolve PDE problem**
Next by Date:
**Re: A question about numerically solving differential equations**
Previous by thread:
**Re: plot function**
Next by thread:
**Re: NDSolve PDE problem**
| |