Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2008

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

Search the Archive

Re: Show and 6.0

  • To: mathgroup at
  • Subject: [mg89452] Re: Show and 6.0
  • From: "David Park" <djmpark at>
  • Date: Tue, 10 Jun 2008 03:38:49 -0400 (EDT)
  • References: <g2ij15$rnk$>


I never Print plots and I never use Show (not that there is anything wrong 
with using these) and I often write multiple statements in one cell some of 
them producing output and some of them not producing output because of a 

Here is an example of a cell expression that I might write. Each statement 
is on a separate line. This provides formatted output, annotation and even a 
plot. In the next to last line I suppressed one output but notice that the 
next line can still refer to it with a %.

Print["Given the two equations:"]
(eqns = {a x + b y == c, d x + e y == f}) // Column
Print["which represent two lines in the plane:"]
With[{a = 1, b = 1, c = 2, d = 1/2, e = 2, f = -1},
 ContourPlot[{a x + b y == c, d x + e y == f}, {x, -10, 10}, {y, -10,
   10}, Frame -> True, ImageSize -> 150]]
Print["we can solve for x and y using Solve."]
xysols = Part[Solve[eqns, {x, y}], 1] // Simplify
Print["Then as a check we can substitute in the original equations."]
eqns /. xysols;
% // Simplify

The new Graphics as Output paradigm for Version 6 is MUCH nicer than the old 
Version 5 Graphics as a side effect. When you wrote your a b plot statement 
notice that Mathematica was actually multiplying the two plots! When you 
used a Plus expression Mathematica actually inserted a + between the two 
plots. This becomes even clearer if you use a Power expression.

a = Plot[x, {x, 0, 1}]; b = Plot[x^2, {x, 0, 1}]; a^b
Clear[a, b]

This leads to an idea for representing complex functions as graphical 
expressions. Here, for example, is a graphical representation of the 
function z^2. Graphical elements are included directly in algebraic 
expressions. That would be much more difficult in Version 5. (The reason I 
use Row instead of Times is to maintain the order of the factors.)

f[r_, \[Theta]_] := r^2 Exp[2 I \[Theta]];
modulusplot =
  ParametricPlot3D[{r Cos[\[Theta]], r Sin[\[Theta]],
    Abs[f[r, \[Theta]]]}, {r, 0, 1}, {\[Theta], 0, 2 \[Pi]},
   PlotStyle -> ColorData["Legacy"]["DodgerBlue"], Mesh -> None,
   ImageSize -> 150, Axes -> None, BoxRatios -> {1, 1, 1/2},
   Boxed -> False, Lighting -> "Neutral"];
argplot =
  ParametricPlot3D[{r Cos[\[Theta]], r Sin[\[Theta]],
    Arg[f[r, \[Theta]]]}, {r, 0, 1}, {\[Theta], 0, 2 \[Pi]},
   PlotStyle -> Orange, Mesh -> None, ImageSize -> 150, Axes -> None,
   BoxRatios -> {1, 1, 1/2}, Boxed -> False, Lighting -> "Neutral"];
Row[{modulusplot, Style[Exp[I argplot], 70]}]

The reason I never use Show is that with the Presentations package I can 
directly combine various graphical objects in one drawing statement. All 
plot outputs are reduced to primitive graphics so they can be directly 
combined. Show is another way of doing this, or you can just keep taking the 
First parts. Whatever the case you have to keep jumping between hierarchical 
levels. That, combined with the confusion of the use of options and how they 
are picked up with a Show statement, or dropped when you take the first 
part, may be a small speed bump but it's enough to deter and confuse many 
users. The Presentations paradigm makes it much easier to think in terms of 
complex, custom graphics and geometrical diagrams. It also clearly separates 
graphical options that affect the drawing of some object from options that 
affect the overall appearance of the graphics. (PlotRange, however, is a 
option that works at both levels.)

According to a recent S15 free seminar WRI is thinking seriously of 
producing a smaller high quality printed book to act as an introduction to 
Mathematica. If this is done, and done right, it might be useful to many 
people. The fact is, that there is so much to Mathematica that people should 
start learning it as soon as possible. Even at that something like MathGroup 
is absolutely necessary. Nobody can master it on their own. I am always 
learning things from the people on MathGroup and am often chagrinned to 
learn something that after all these years I might have been expected to 
David Park
djmpark at

"AES" <siegman at> wrote in message 
news:g2ij15$rnk$1 at
>I believe I've more or less fully grasped the explanation of what Show[]
> now does in 6.0 that's been repeatedly restated in all the recent and
> earlier responses to all the repeated plaintive posts about ""Why
> doesn't my plot appear?!?"  --- and this explanation actually make
> reasonable sense to me.
> [It's less obvious, however, how someone is suppose to know that
> Print[]; _will_ print something on screen, but Show[]; _won't_ show
> anything on screen.  Read the Helps for these two commands and see the
> help pages make this obvious to you)
> I'm less sure that these expert respondents -- and also WRI -- have
> grasped _why_ these recurrent queries keep recurring; so led me add a
> few (5 actually) responses myself on that point (though it will make for
> a long post):
> 1)  I suggest the primary problem is a deeper, long-standing, and quite
> understandable misunderstanding of compound expressions, and especially
> the role of semicolons in compound expressions.
> To quote, for example, from one of the recent "Plot and Show[]"
> responses, posted by someone who's often on this group:
>> In general, a semi-colon is used to separate the parts of a compound
>> expression
> Well, the correct response to that response is "NOT!", right?  Or at
> least, "not entirely".
> That is to say, is the primary function of a semicolon to separate the
> parts of compound expressions? -- or is it to suppress output from an
> expression?  And is it always necessary between two expressions?
> I've thought for all my years with Mathematica that you _had_ to put
> semicolons between two successive expressions on the same line or in the
> same cell, except for the very last line in the cell.  And, I guess I
> deduced that this made sense and was necessary because logically you
> always needed to be clear where one expression ended and the next one
> began.
> Given this, I would never have believed that giving as input, on a
> single line and in a single cell, the following
>   a = Plot[x, {x, 0, 1}];  b = Plot[x^2, {x, 0, 1}];  a  b
> would be a legal input -- until I tried it a couple of minutes ago.
> But wait a minute!  Aren't a and b now expressions (separately)?  So,
> don't they require a semicolon between them, to separate them?
> [In fact, I just tried the above input with  a + b  and then  a * b at
> the end of the line -- and they all worked exactly the same as just
> a b . WOW!!!]
> Semicolons need explaining and understanding!
> 2)  So, where would an innocent but intelligent Mathematica user go to
> unravel these mysteries.  I'd issue a small challenge:  Don't explain
> compound expressions and semicolons to me.  Show us -- show me -- in
> detail how a novice could learn the at least the essential elementary
> rules of compound expressions and semicolons FROM THE CURRENTLY
> [And, see if the Help for ";" comports with the results I just
> experienced in the preceding.]
> 3)  And then think a little deeper:  Ask yourself, WHY do these
> recurrent queries about Show[]keep recurring so recurrently?
> Could it just be because the _documentation_ provided for 6.0's
> introduction, and for the massive changes it introduced, has not been
> adequate in explaining or warning about these sizable changes for a
> large class of users???
> Let's just leave that thought to simmer for a while . . .
> 4)  OK, now having understood the new character of Show[], what should
> users do if they want to really show some graphics -- have them appear
> on screen -- in the middle of a long compound expression.
> Respondents keep suggesting that one should Print[] the graphics.  OK,
> that works, of course -- but it's a poor solution, among other things
> because Print[] messes with the sizes at which the graphics are
> displayed, in a way that doesn't always match with what's expected.
> Something better is needed.
> 5) Finally, to respond on a quite different aspect of Show[] that's also
> been the subject of a thread recently:
> Go to the Help for Show[], where you'll read:
>      Show[g1,g2]  . . . concatenates the graphics primitives in the
>      gi, effectively overlaying the graphics.
> and then try
>      a = Plot3D[x y, {x, 0, 1}, {y, 0, 1}];
>      b = Graphics3D[{Red, Thickness[0.01],
>             Line[{{1/2, 1/2, 0}, {1/2, 1/2, 2}}]}];
> followed by Show[a, b]  and then  Show[b, a].  Evidently,
> Show[a,b] =|= Show[b,a].
> I guess I grasp what happens here, don't need an explanation, and can
> sort of understand, yeah, that's what "concatenate" gives you.  But it's
> a lesson on how careful you have to be with these things.
> That's it for the 5.

  • Prev by Date: Re: Dynamic GUI problems
  • Next by Date: Re: Re: Re: Adding markers on the surface of a Plot3D?
  • Previous by thread: Re: Show and 6.0
  • Next by thread: Re: Show and 6.0