mptrace: Parse 'mpost' Log Files

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/trace.R

Description

Read a log file generated by mpost (possibly via mpost) to obtain solved MetaPost path information (which can then be drawn by grid.metapost).

Usage

1
2
3
mptrace(logfile = "fig.log", fig = 1)
mpbbox(psfile)
mpvp(psfile, ...)

Arguments

logfile

The name of a log file generated by mpost.

fig

Which figure to read from the file. If numeric, then read the figth figure; if character, then read the figure labelled fig.

psfile

The name of a PostScript files generated by mpost.

...

Arguments passed on to viewport.

Details

The log file must have been generated by mpost with tracingchoices=1 (possibly using mpost(..., tracing=TRUE)).

The functions mpbbox and mpvp parse a PostScript file that was generated by mpost, returning the bounding box of the output and a viewport based on that bounding box respectively.

Value

A list of Bezier control points (mpcontrols objects).

Author(s)

Paul Murrell

See Also

mpost, grid.metapost

Examples

1
2
3
4
5
6
7
8
9
oldunits <- options(metapost.units="in")
oldwd <- setwd(tempdir())
p <- knot(0, 0) + dir(0) + dir(0) + knot(1, 1)
metapost(p, "fig.mp")
mpost("fig.mp")
paths <- mptrace("fig.log")
grid.metapost(paths)
setwd(oldwd)
options(oldunits)

pmur002/metapost documentation built on May 9, 2020, 2:56 a.m.