Send graphics to file AND/OR to notebook with one DisplayFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg71495] Send graphics to file AND/OR to notebook with one DisplayFunction
- From: "zac" <replicatorzed at gmail.com>
- Date: Mon, 20 Nov 2006 18:11:58 -0500 (EST)
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
- Follow-Ups:
- Re: Send graphics to file AND/OR to notebook with one DisplayFunction
- From: "Chris Chiasson" <chris@chiasson.name>
- Re: Send graphics to file AND/OR to notebook with one DisplayFunction