MathGroup Archive 1996

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

Search the Archive

Re: can mathematica do this, please answer

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4218] Re: can mathematica do this, please answer
  • From: wagner at motel6.cs.colorado.edu (Dave Wagner)
  • Date: Tue, 18 Jun 1996 03:26:20 -0400
  • Organization: University of Colorado, Boulder
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4p35oh$n9o at dragonfly.wolfram.com>,
Gunnar Larsen <gunnarl at interlink.no> wrote:
>
>I want to read in an ascii file containing data 
>and plot each value in a sequence, generating an animated
>graph. Each picture should be saved as a bitmap, (numbered
>graf0000.bmp, graf0001.bmp.....)
>This is going to be laid out on video.
>The bitmap saving must be automatic because it is a huge amount 
>of data dispalyed. 

There is a way to do this using version 3.0 of Mathematica.
Here is an example from my forthcoming book, "Power Programming
with Mathematica: The Kernel", which is due out in about a month -
about the same time that version 3.0 is estimated to be released.
(What a coincidence :-) )

--- begin excerpt ---

12.3.3 Display 
--------------

Display[s, g] writes the Mathematica graphics object g to the stream s in 
PostScript format. If s refers to a notebook window, the graphic is rendered in 
the notebook. In general, however, you can use Display to write the PostScript 
to any stream, such as a file or pipe.

...

When you create a Mathematica graphic using any of the plotting commands, the 
return value from the function is a graphics object. The picture that you see on
your screen is actually a side effect that is caused by passing the graphics 
object to the function specified by the DisplayFunction option.

	    Options[Plot, DisplayFunction]
	    {DisplayFunction :> $DisplayFunction}

	    $DisplayFunction
	    Display[$Display, #1] &

The system variable $Display contains a channel (a stream or list of streams) to
which the PostScript form of graphics objects should be written. The notebook 
front end initializes $Display to "stdout". Thus, in a roundabout way, the 
default value of the DisplayFunction option is Display["stdout", #]&.

...

In version 3.0, Display takes an optional third argument that specifies a format
for the graphics output. "MPS" (Mathematica PostScript) is the default, but 
other possible values include "EPS" (encapsulated PostScript), "GIF", "TIFF", 
"XBitmap" (X-Windows), "MetaFile" (Microsoft Windows), and "PICT" (MacOS). (See 
the entry for Display in [Wolfram 96] $A.10 for a complete list of supported 
formats.) So, for example, if you want to write a GIF version of every graphic 
in a Mathematica session to a separate file, as well as seeing each graphic on 
the screen, you could do something like the following:

	    n = 1;
	    $DisplayFunction = Function[g,
		Display[$Display, g];
		Display["GIFfile"<>ToString[n++], g, "GIF"]]


--- end of excerpt ---
Power Programming with Mathematica: The Kernel
Copyright 1996 McGraw-Hill
For more information: http://www.princon.com/dbwagner/PPK/description.html

		Dave Wagner
		Principia Consulting
		(303) 786-8371
		dbwagner at princon.com
		http://www.princon.com/princon

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Binary files under MS Windows
  • Next by Date: Re: How can this MapAt application be done more efficiently
  • Previous by thread: can mathematica do this, please answer
  • Next by thread: Functional programming; Outer; NonlinearFit