Changes

Jump to navigation Jump to search
756 bytes removed ,  04:59, 28 February 2007
link to windows binary added, partial revision (but still needs changes)
[http://www.gnuplot.info Gnuplot] is a portable command-line driven utility for function plotting for many platforms.
All To make the examples on this page talk about how the things are supposed to work once the new terminal is uploaded. The code described doesn't work yet unless , you download new files from the darcs repository need a modified binary of Gnuplot (see below).}}
== Minimal Example ==
% write a script for gnuplot
\startGNUPLOTscript{[sin}]
plot sin(x)
\stopGNUPLOTscript
* '''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 you need to delete <code>tex/context/base/m-gnuplot.tex</code>)
* '''Gnuplot has to be installed''' (and in your PATH)
:On most Linux installations this is probably already the case. On Windows you have to create a file <code>gnuplot.bat</code> with something like:
"C:\Program Files\gnuplot\bin\wgnupl32.exe" %*:and put that file to a <i>"visible place"</i> (has to be found in PATH).* if you want to === To use the ConTeXt terminal (defaultrecommended)===* for Windows, '''you need modified can take [http://dl.contextgarden.net/modules/gnuplot-win.zip these] binaries''' until they officially become part of from [[modules:gnuplot-win|Modules in the garden]]** if you want to try it on for Linux, or Mac you have to download the source from http://www.gnuplot.info, add copy [http://renojrldl.lrvcontextgarden.uvsq.frnet/modules/projectsgnuplot-win/gpcontextgnuplot/term/context.trm context.trm]to <code>term/</code>, fix the file add <code>#include "context.trm"</code> to <code>src/term.h</code> and compile it.** For windows version of binary or if you have problems compiling it, please mail me to <mojca.miklavec.lists(at)gmail.com>
* '''[[write18]]''' has to be enabled
Feel free to contact me in case of problems.
<i>The module has some strange problems when used on MikTeX (memory limit exceeded or something similar). I'll try to figure out what exactly is going on.</i> --[[User:Mojca Miklavec|Mojca]]== More complex example ==
== Terminals == Gnuplot support output in different formats with, for example set terminal mp color solidwill output a metapost document with colors and without dashed lines. After some appropriate preprocessing (with [[MPtoDF]] for I need to change this particular case) this file can be included in PDF documents. You can specify the terminal with<texcode>\setupGNUPLOT[terminal=mp,options=color solid]</texcode> * <code>terminal=</code> is mandatory since that't the only way example to tell ConTeXt how to preprocess the file.* <code>options=</code> is optional and is appended to the end of <code>set terminal [terminal name]</code>. You can also override it by saying<texcode>\startGNUPLOTinclusionsset terminal mp color solid\stopGNUPLOTinclusions</texcode>But you have to be careful that you don't set any highlight other terminal with <code>output=</code> thenaspects<!-- Another way to specify it Metapost is to override the terminal setting kind-of-> Currently supported terminals are:* [http://www.gnuplot.info/docs/gnuplot.html#mp mp/metapost]: <b>most beautiful results</b>, uses [[MPtoPDF]] to convert images to pdf, but the context obsolete since ConTeXt terminal should replace was derived from it* [http://wwwand produces superior results.gnuplot.info/docs/gnuplot.html#postscript_ ps/postscript]: most advanced in But the number of supported features* [http://www.gnuplot.info/docs/gnuplotexample below should still be valid.html#png_(OLD) png]: outputs bitmap images (no preprocessing needed)* [http://www.gnuplot.info/docs/gnuplot.html#pdf pdf]: outputs PDF directly (no preprocessing needed), but is usually not available in most binaries of gnuplot* '''context''': new === More complex example with MetaPost or ConTeXt terminal === Metapost produces the plots of a relatively high quality. You can use TeX commands to format the title, label axes and legend.
<texcode>
\usemodule[gnuplot]
% output may be "mp/metapost", "ps/postscript", "pdf" or "png"; ps is currently the default
\setupGNUPLOT[terminal=mp,option=color]
\stopGNUPLOTinclusions
\startGNUPLOTscript{[tan}]
plot tan(x) t '$\tan(x)$'
\stopGNUPLOTscript
\startGNUPLOTscript{[sin}]
plot 4*sin(x)+x t '$4\sin(x)+x$', x t '$x$' lt 3
\stopGNUPLOTscript
</texcode>
There's only one problem that you have to be careful about: [[MetaPost]] terminal uses <code>cmr</code> fonts for labels. If you have the stand-alone distributions, you either have to install them by yourself or to play with <code>set terminal mp {fontname}</code> a bit (http://www.gnuplot.info/docs/gnuplot.html#mp).== Using other terminals ==
=== More complex example: Multiple terminals ===<i>(Needs a revision.)</i>
You can use Gnuplot support output in different terminals formats with, for plotting the same functionexample set terminal mp color solidwill output a metapost document with colors and without dashed lines. After some appropriate preprocessing (with [[MPtoDF]] for this particular case) this file can be included in PDF documents.
{{todo|an exampleYou can specify the terminal with<texcode>\setupGNUPLOT[terminal=mp, similar options=color solid]</texcode> * <code>terminal=</code> is mandatory since that't the only way to tell ConTeXt how to preprocess the one in file.* <code>options=</code> is optional and is appended to the end of <code>set terminal [terminal name]</code>. You can also override it by saying<texcode>\startGNUPLOTinclusionsset terminal mp color solid\stopGNUPLOTinclusions</texcode>But you have to be careful that you don't set any other terminal with <code>output=</code> then. <!-- Another way to specify it is to override the terminal setting --> Currently supported terminals are:* [sourcehttp:m-//www.gnuplot.tex|m-info/docs/gnuplot.texhtml#mp mp/metapost]: uses [[MPtoPDF]], some to convert images to get a visual impression pdf, but the context terminal should replace it* [http://www.gnuplot.info/docs/gnuplot.html#postscript_ ps/postscript]: most advanced in the number of the main differences supported features* [http://www.gnuplot.info/docs/gnuplot.html#png_(OLD) png]: outputs bitmap images (no preprocessing needed)* [http://www.gnuplot.info/docs/gnuplot.html#pdf pdf]: outputs PDF directly (no preprocessing needed), but is usually not available in terminals}}most binaries of gnuplot* '''context''':
== Development ==
* [http://renojrl.lrv.uvsq.fr/darcsweb.cgi?r=gpConTeXt;a=summary darcs repository] (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]

Navigation menu