MathGroup Archive 2000

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

Search the Archive

Re: export graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22260] Re: [mg22202] export graphics
  • From: Preston Nichols <pnichols at wittenberg.edu>
  • Date: Sat, 19 Feb 2000 01:34:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Wolfgang, and all:

When we upgraded to version 4 at my institution, I threw together a web
page (mostly for the benefit of my colleagues here) describing the simplest
new ways to export graphics.  You can find it here:

http://www.wittenberg.edu/academics/mathcomp/nicholswww/mmamisc/mmaexport.html

The simple animated gif example on that page comes down to this:

sinemovie = Table[
    Plot[Sin[x - t], {x, 0, 2*Pi}], 
    {t, Pi/10, 2*Pi, Pi/10}]; 

Export["sineloop.gif", sinemovie,
    ConversionOptions -> {"Loop" -> True}];

You could wrap Block[{$DisplayFunction=Identity},     ] around the Table
command if you don't want to see the frames before exporting them.

Part of the reason your attempt (below) went wrong is (perhaps obviously?)
that Animate returns Null, not Graphics objects.  For the same reason, I
had to use Table rather than Do in my example above.

(In the code for Graphics`Animation`, one can see that the last action
performed by Animate is to explicitly call the low-level function,
analogous to $DisplayFunction, which displays the frames of the animation,
by default in the Notebook window.)

I have no idea why Export-ing a single picture didn't work correctly for you.

Preston Nichols
Mathematics and Computer Science
Wittenberg University

At 02:34 AM 02/18/2000 -0500, schadow at netcom.ca wrote:
>Hi,
>
>Inspired by a question about animated gif I tried to build some my own,
>but without success:
>
><< Graphics`Animation`
>
>gr = Animate[
>    Plot[Sin[x t], {x, -\[Pi], \[Pi]}, PlotRange -> {-1, 1}], {t, 0, 1}]
>
>Export["gr.gif", gr,"GIF"]
>
>gives the error message
>
>Export::"type": "\!\(Null\) cannot be exported to the \!\(\"GIF\"\)
>format."
>
>
>Let's try a single picture:
>
>gr2 = Plot[Sin[x], {x, -Pi, Pi}]
>Export["gr.gif", gr2]
>
>gives a black gif picture. On the other hand
>
>Export["gr.eps", gr2]
>
>works fine. 
>
>A more successful way to get a GIF image is:
>
>Display["gr.gif", gr2, "GIF"]
>
>The online help says
>
>?Display
>
>Display[channel, expr,"format\"] writes boxes, cells or notebook
>expressions in the specified format."
>
>?Export
>
>Export[\"file\", expr, \"format\"] exports data to a file, converting it
>to the specified format."
>
>So, the calling sequence is similar, but only the latter case worked for
>me. What am I doing wrong here, and moreover how do I get the animated
>gif? (I am working with Mathematica 4.0 under Linux)
>
>Thanks for your help,
>Wolfgang
>
>========================================================================
>Wolfgang Schadow             Phone: +1-604-222-1047 ext. 6453 (office) 
>TRIUMF                              +1-604-875-6066           (home)   
>Theory Group                   FAX: +1-604-222-1074
>4004 Wesbrook Mall
>Vancouver, B.C. V6T 2A3      email: schadow at triumf.ca
>Canada                       www  : http://www.triumf.ca/people/schadow 
>
>========================================================================
>



  • Prev by Date: Re: Mathematica formulae as Word metafiles
  • Next by Date: Re: Mathematica bug in Graphics3D ??
  • Previous by thread: Re: export graphics
  • Next by thread: Re: Re: export graphics