grid.figure: Draw a MetaPost figure.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/grid.R

Description

Draw a MetaPost figure in grid graphics.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## S3 method for class 'mppath'
figureGrob(figure,
                            x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                            width = unit(1, "npc"), height = unit(1, "npc"),
                            just = "centre", 
                            default.units = "npc",
                            expansion = 0, xscale = NULL, yscale = NULL,
                            distort = FALSE, clip = FALSE,
                            gp = gpar(), name = NULL, digits=2, ...)
## S3 method for class 'mpfigure'
figureGrob(figure,
                              x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                              width = unit(1, "npc"), height = unit(1, "npc"),
                              just = "centre",
                              default.units = "npc",
                              expansion = 0, xscale = NULL, yscale = NULL,
                              distort = FALSE, clip = FALSE,
                              gp = gpar(), name = NULL, ...)
grid.figure(...)

Arguments

figure

A MetaPost path, either unsolved (a description generated using knot etc), or solved (as produced by mptrace).

x, y, width, height, just, default.units

The location, size, and justification of the figure.

expansion

A factor to extend the scales of the figure (to create an empty margin around the figure).

xscale, yscale

Override the scales used to draw the figure; by default, these are chosen to encompass the figure (control points).

distort

Should the aspect ratio of the original figure be retained.

clip

Should drawing be clipped to the bounds of the figure (as defined by the scales).

gp

Graphical parameters (from a call to gpar).

name

A name for the grob that is created.

digits

The number of decimal places to use when writing floating point values in Figure code.

...

Arguments passed to figureGrob.

Value

figureGrob creates a "figuregrob" object.

Author(s)

Paul Murrell

See Also

knot, mptrace.

Examples

1
2
3
4
oldunits <- options(figure.units="in")
p <- knot(0, 0) + dir(0) + dir(0) + knot(1, 1) 
grid.figure(p)
options(oldunits)

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