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

MathGroup Archive 1994

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

Search the Archive

re: From Mathematica to Gnuplot

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: re: From Mathematica to Gnuplot
  • From: Paul=Rubin%Management%Business at banyan.cl.msu.edu
  • Date: Mon, 13 Jun 94 10:49:10 EDT

Johannes Idso <JOHANNES-IDSO at sfdh.sognhs.no> wrote:

>I want to import graphs from Mathematica into a LeTeX
>document. Since my dvips-program does not accept
>import of pictures in postscript, I want to do this:
>Save the graph made in Mathematica  as many points in
>an ASCII-file and then let Gnuplot read the ASCII-file and
>produce a new picture.
>How do I save the points of a graph?

In[]:=  p = Plot[ Sin[x], {x, 0, 2 Pi} ];
In[]:=  x = First[ First[ Cases[ p, Line[_], 20 ] ] ];
(* x is a list of the points *)
In[]:=  test = OpenWrite[ "g:\\test", FormatType -> OutputForm ];
(* opens the output file *)
In[]:=  Write[ test, #[[1]], ", ", #[[2]] ]& /@ Map[ FortranForm, x, {2} ];
(* I'm assuming you want exponents written Fortran-style, and I'm using
   a comma and a space to separate abscissa and ordinate - you can substitute
   a tab or whatever *)   
In[]:=  Close [test ];

**************************************************************************
* Paul A. Rubin                                  Phone: (517) 336-3509   *
* Department of Management                       Fax:   (517) 336-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *
**************************************************************************
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE






  • Prev by Date: Re:Coloring 2DPlot with different colors
  • Next by Date: re: Specifying rules
  • Previous by thread: RE: From Mathematica to Gnuplot
  • Next by thread: MW - Education Today - Reviews