Credits Overview Plotting Styles Commands Terminals

context

ConTeXt is a macro package for TeX, highly integrated with Metapost (for drawing figures) and intended for creation of high-quality PDF documents. The terminal outputs Metafun source, which can be edited manually, but you should be able to configure most things from outside.

For an average user of ConTeXt + gnuplot module it's recommended to refer to Using ConTeXt rather than reading this page or to read the manual of the gnuplot module for ConTeXt.

The context terminal supports the following options:

Syntax:

     set term context {default}
             {defaultsize | size <scale> | size <xsize>{in|cm}, <ysize>{in|cm}}
             {input | standalone}
             {timestamp | notimestamp}
             {noheader | header "<header>"}
             {color | colour | monochrome}
             {rounded | mitered | beveled} {round | butt | squared}
             {dashed | solid} {dashlength | dl <dl>}
             {linewidth | lw <lw>}
             {fontscale <fontscale>}
             {mppoints | texpoints}
             {inlineimages | externalimages}
             {defaultfont | font "{<fontname>}{,<fontsize>}"}

In non-standalone (input) graphic only parameters size to select graphic size, fontscale to scale all the labels for a factor <fontscale> and font size, make sense, the rest is silently ignored and should be configured in the .tex file which inputs the graphic. It's highly recommended to set the proper fontsize if document font differs from 12pt, so that gnuplot will know how much space to reserve for labels.

default resets all the options to their default values.

defaultsize sets the plot size to 5in,3in. size <scale> sets the plot size to <scale> times <default value>. If two arguments are given (separated with ','), the first one sets the horizontal size and the second one the vertical size. Size may be given without units (in which case it means relative to the default value), with inches ('in') or centimeters ('cm').

input (default) creates a graphic that can be included into another ConTeXt document. standalone adds some lines, so that the document might be compiled as-is. You might also want to add header in that case.

Use header for any additional settings/definitions/macros that you might want to include in a standalone graphic. noheader is the default.

notimestamp prevents printing creation time in comments (if version control is used, one may prefer not to commit new version when only date changes).

color to make color plots is the default, but monochrome doesn't do anything special yet. If you have any good ideas how the behaviour should differ to suit the monochrome printers better, your suggestions are welcome.

rounded (default), mitered and beveled control the shape of line joins. round (default), butt and squared control the shape of line caps. See PostScript or PDF Reference Manual for explanation. For wild-behaving functions and thick lines it is better to use rounded and round to prevent sharp corners in line joins. (Some general support for this should be added to Gnuplot, so that the same options could be set for each line (style) separately).

dashed (default) uses different dash patterns for different line types, solid draws all plots with solid lines.

dashlength or dl scales the length of the dashed-line segments by <dl>. linewidth or lw scales all linewidths by <lw>. (lw 1 stands for 0.5bp, which is the default line width when drawing with Metapost.) fontscale scales text labels for factor <fontscale> relative to default document font.

mppoints uses predefined point shapes, drawn in Metapost. texpoints uses easily configurable set of symbols, defined with ConTeXt in the following way:

     \defineconversion[my own points][+,{\ss x},\mathematics{\circ}]
     \setupGNUPLOTterminal[context][points=tex,pointset=my own points]

inlineimages writes binary images to a string and only works in ConTeXt MKIV. externalimages writes PNG files to disk and also works with ConTeXt MKII. Gnuplot needs to have support for PNG images built in for this to work.

With font you can set font name and size in standalone graphics. In non-standalone (input) mode only the font size is important to reserve enough space for text labels. The command

     set term context font "myfont,ss,10"

will result in

     \setupbodyfont[myfont,ss,10pt]

If you additionally set fontscale to 0.8 for example, then the resulting font will be 8pt big and

     set label ... font "myfont,12"

will come out as 9.6pt.

It is your own responsibility to provide proper typescripts (and header), otherwise switching the font will have no effect. For a standard font in ConTeXt MKII (pdfTeX) you could use:

     set terminal context standalone header '\usetypescript[iwona][ec]' \
         font "iwona,ss,11"

Please take a look into ConTeXt documentation, wiki or mailing list (archives) for any up-to-date information about font usage.

Examples:

     set terminal context size 10cm, 5cm     # 10cm, 5cm
     set terminal context size 4in, 3in      # 4in, 3in

For standalone (whole-page) plots with labels in UTF-8 encoding:

     set terminal context standalone header '\enableregime[utf-8]'
Subtopics