MathGroup Archive 2006

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

Search the Archive

Send graphics to file AND/OR to notebook with one DisplayFunction


Hi All,
I've posted this problem on Wolfram's Student Support Forum, but no
full answer was given to it.

I've got this problem with Display:

Plot[x, {x, 0, 5}, DisplayFunction -> (Display[{"stdout", "test.gif"},
#1, "GIF"]&)];

where the given format "GIF" seems to collide with the standard output.
The target is to both display the plot in the notebook, and to save it
into a file. If I don't feed the 3rd argument ("GIF"), the plot does
appear in the notebook, and a file is being generated, although it is
an empty gif file.

In more detail: the problem is that I want to make both the
notebook-display and the file saving be independently suppressable.
Take for example the code below:

Plot[x, {x, 0, 5},DisplayFunction ->
Which[
askToFile && askToConsole, (Display[{"stdout", "test.gif"}, #1, "GIF"]
&),
askToFile && ! askToConsole, (Display["test.gif", #1, "GIF"] &),
! askToFile && askToConsole, (Display[$Display, #1] &),
! askToFile && ! askToConsole, Identity
];
];

where the variables askToFile and askToConsole are booleans.

As far as I know, Export cannot be suppressed "from the inside".
Furthermore, I do not want to make two statements, one for displaying
the graphic with Plot (or Show), and one for saving it with Export. It
seems to me that defining a new $DisplayFunction would be the best
solution.

Any help would be appreciated.

Istvan


  • Prev by Date: Re: Converting an expression to a list of terms?
  • Next by Date: Re: returning variable number of arguments from a Module[ ]
  • Previous by thread: Re: Re: How to determine whether a message has
  • Next by thread: Re: Send graphics to file AND/OR to notebook with one DisplayFunction