metapost (version 1.0-6)

mptrace: Parse mpost Log Files

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

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

Arguments

logfile

The name of a log file generated by mpost.

psfile

The name of a PostScript files generated by mpost.

...

Arguments passed on to viewport.

Value

A list of Bezier control points (mpcontrols objects).

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.

See Also

mpost, grid.metapost

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab