MathGroup Archive 2007

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

Search the Archive

Re: Graphics output in Mathematica 6 functions ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80347] Re: Graphics output in Mathematica 6 functions ?
  • From: dr DanW <dmaxwarren at gmail.com>
  • Date: Sat, 18 Aug 2007 05:36:22 -0400 (EDT)
  • References: <fa3e2l$16n$1@smc.vnet.net>

On Aug 17, 1:09 am, Alex <axel.kow... at rub.de> wrote:
> Hi,
>
> one modification in Mathematica 6 is that a semicolon at the end of a plot
> command suppresses the output of the complete graphics.
> My question is now how can I generate graphics output from one of my
> own functions?
> I must not have a semicolon at the end of the Plot[] command because
> otherwise no diagram appears, but on the other hand I need a semicolon
> to separate the different commands within my function !?
>
> Alex

Alex,
I ran into this the other day.  Previous versions of Mathematica
treated graphics output as a side effect, with the output being
Graphics[...], which you can show.  In Mathematica 6, the graphic
object itself is the output, and is suppressed by the semicolon.

If you want to reproduce the old behavior of displaying the graphic as
a side effect, the answer is so obvious that it didn't occur to me for
some time: simply use Print[].

For example, I have a function that performs a curve fit.  The output
I want from the function is the fit parameters, but I want to display
the graphics as well as a visual check for the quality of the fit.
The structure of my function (leaving out many details) is:

FitPlot[...]:=Module[{...},
fitparams=FindFit[...];
graph=Plot[func/.fitparams];
Print[graph];
fitparams
]



  • Prev by Date: Documentation Center (Mathematica Help) problem and solution
  • Next by Date: Re: 3DPlot in Mathematica 6
  • Previous by thread: Re: Graphics output in Mathematica 6 functions ?
  • Next by thread: 3DPlot in Mathematica 6