Changes

Jump to navigation Jump to search
880 bytes added ,  09:43, 11 April 2012
some updates (not yet finished)
[http://www.gnuplot.info Gnuplot] is a portable command-line driven utility for function plotting for many platforms.
To make the examples on this page work, you need a modified binary of Gnuplot 4.6.0 or later (see belowor self-compiled binary).
== Minimal Example ==
== Requirements ==
* '''recent version of ConTeXt''' and '''texmfstart''' in your PATH* '''[http://modules.contextgarden.net/gnuplot Gnuplot module]''' (on MikTeX it's part of the distribution already, but there is still an old version and ** in TeX Live you need to delete have <code>tex/context-gnuplot</base/mcode> installed, in [[ConTeXt Standalone]] you can install it with <code>--modules=t-gnuplot.tex</code>)switch
* '''Gnuplot has to be installed''' (and in your PATH)
:On most Linux installations this is probably already the case. On Windows gnuplot.exe is usually also shipped and you have need to make sure that it is in PATH. In case that the binary has a different name, you could create a file <code>gnuplot.bat</code> with something like:
"C:\Program Files\gnuplot\bin\wgnupl32.exe" %*
:(if that was the binary name) and put that file to a <i>"visible place"</i> (has to be found in PATH).Please note: if calling <code>gnuplot</code> from cmd works for you, there is no need to do anything extra.* '''[[write18]]''' has to be enabled
=== To use the ConTeXt terminal (recommended) ===
* for ==== Windows, you ====You can take fetch binaries from [http://dl.contextgardensourceforge.net/modulesprojects/gnuplot-win.zip these] binaries from [[modules:/files/gnuplot-win|Modules in the garden]/ sourceforge (released versions)]* for Linux or Mac you have to download the source from [http://www.gnuplottatsuromatsuoka.info (use [http:com/gnuplot/downloads.sourceforge.netEng/gnuplotwinbin/gnuplot-Tatsuro Matsuoka (latest cvs version)].==== Unix or Mac ====The easiest way is to use version 4.26.0or later shipped by your distribution.tarIf that version is too old, you need to compile your own.gz this file]), extract it, copy [http If you want to use the version from trunk: # unofficial; you can also use official cvs git clone git://dlgithub.contextgarden.net/modulescom/gnuplot-win/gnuplot/term/context.trm context.trm] to <code>term/</code>, add <code>#include "context.trm"</code> to <code>src/term.h</code> and compile it usinggit
./prepare
./configure
make
* '''[ make installI use <code>./configure --prefix=$PWD/inst</code> to avoid cluttering the system and install gnuplot to my personal directory. You can use other flags to configure for a different choice of GUI terminals. If you want to use the released version, get it from [write18http://sourceforge.net/projects/gnuplot/files/gnuplot/ sourceforge]]''' has to be enabledand do the same, just skip the <code>./prepare</code>. The latest version of context terminal is available at http://github.com/mojca/gnuplot/raw/master/term/context.trm. Feel free to contact me [[User:Mojca Miklavec|Mojca]] in case of problems.
== Creating stand-alone, whole-page plots ==
Here's an example of how to make a stand-alone ConTeXt document with one plot per page:
set term context standalone size 15cm,10cm header '\usetypescript[iwona][ec]' font 'iwona,ss' 10dd
set output 'example.tex'
plot ...
== More complex example ==
 
(I need to change this example to highlight other aspects. Metapost is kind-of-obsolete since ConTeXt terminal was derived from it and produces superior results. But the example below should still be valid.)
<texcode>
\usemodule[gnuplot]
\setupGNUPLOT[terminal=mptikz,option=color]% terminal=mp if you only have an old gnuplot at hand
% general settings for the whole document
# (0.0, 0.5, 1.0, 1.5, ...) instead of
# (0, 0.5, 1, 1.5, ...)
set format y '\%.1f'
\stopGNUPLOTinclusions
Gnuplot support output in different formats with, for example
set terminal mp color solid
will output a metapost document with colors and without dashed lines. After some appropriate preprocessing (with [[MPtoDFMPtoPDF]] for this particular case) this file can be included in PDF documents.
You can specify the terminal with
<!-- Another way to specify it is to override the terminal setting -->
Currently supported terminals are(attention: links not from the latest documentation):
* [http://www.gnuplot.info/docs/gnuplot.html#mp mp/metapost]: uses [[MPtoPDF]] to convert images to pdf, but the context terminal should replace it
* [http://www.gnuplot.info/docs/gnuplot.html#postscript_ ps/postscript]: most advanced in the number of supported features
* [http://www.gnuplot.info/docsdocs_4.0/gnuplot.html#png_%28NEW%29 png (OLD1) ],[http://www.gnuplot.info/docs_4.2/gnuplot.html#x1-41500051.53 png(2)]: outputs bitmap images (no preprocessing needed)* [http://www.gnuplot.info/docsdocs_4.0/gnuplot.html#pdf pdf(old)],[http://www.gnuplot.info/docs_4.2/gnuplot.html#x1-41300051.51 pdf (new)]: outputs PDF directly for (no preprocessing needed), but is usually not available in most binaries of gnuplot* '''context''':  == Development ==
* The current gnuplot-documentation can be downloaded [http://renojrlwww.lrvgnuplot.uvsqinfo/docs_4.fr6/darcswebgnuplot.cgi?r=gpConTeXt;a=summary darcs repositorypdf here] (maintained by Renaud Aubin; currently I'm unable to login, so it's not up to date)* [http://groups.google.com/group/gnuplot-context mailing list]
== History ==
** [http://comp.uark.edu/~luecking/tex/mfpic.html mfpic] - a scheme for producing pictures from LaTeX commands. The LaTeX commands generate a input file to be processed by Metapost.
** [http://matplotlib.sourceforge.net matplotlib] - a Matlab-inspired Python based plotting tool which incorporates many features, including the use of TeX in labels, titles etc.
** [http://tug.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/ pgfplots] - a TikZ-based LaTeX package for drawing graphs
=== Other links ===
* [http://tug.ctan.org/tex-archive/macros/latex/contrib/exceltex/ exceltex] - an interesting LaTeX package to get data from Excel into LaTeX
[[Image:Slo Ministry of Higher Education Science and Technology.jpg]]
[[Category:Modules]]
[[Category:Graphics]]
[[Category:Math]]

Navigation menu