Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

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


  • 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