Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Plot[], Show[] and ; in Version 6

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76534] Re: Plot[], Show[] and ; in Version 6
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Wed, 23 May 2007 05:39:12 -0400 (EDT)
  • Organization: University of Bergen
  • References: <f2u4am$jnp$1@smc.vnet.net>

yasdfer at yahoo.com wrote:
> Since version 6.0 suppresses Plot/Show outputs with ; (semicolon), how
> do you plot and then do additional numerical (or graphical) outputs? I
> have a lot of existing notebooks that follow such pattern and I am
> hoping that there are some quick fixes.
> 
> For example, the following would work in older version and not in 6:
> 
> Block[{x=1,y=2},
> Plot[x,{x,0,1}];
> Print[Sqrt[y]];
> Plot[x^2,{x,0,1}]
> ]
> 
> Thanks,
> 
> -Victor

Hi Victor,

Try to avoid procedural approaches like this. You almost never need to 
use Print[] in Mathematica (I only use it for debugging).

Instead of using explicit output functions, just return the results. 
This is now possible with graphics in v6.

In 5.2 you did Do[Plot[Sin[k x], {x, 0, 2 Pi}], {k, 1, 5}].
Now change that to Table[Plot[Sin[k x], {x, 0, 2 Pi}], {k, 1, 5}].

Or instead of the example you gave with Block, use something like

With[{a=1, b=2},
  { Plot[a*x, {x,0,1}], Sqrt[y], Plot[b*x^2, {x,0,1}] }
]

If you really really want explicit output functions, you can use Print 
with graphics. But I strongly suggest you avoid this. If you don't like 
the layout of graphics when output as elements of a list, use 
GraphicsColumn, GraphicsRow, GraphicsGrid, Grid etc.

Szabolcs


  • Prev by Date: Re: Bitmap data extraction (matrix of matrix)
  • Next by Date: Re: Evaluation Question
  • Previous by thread: Re: Plot[], Show[] and ; in Version 6
  • Next by thread: Accessing network devices in v6.0