moonGrob: Draw a moon

Description Usage Arguments Details Value Examples

View source: R/moonGrob.R

Description

Functions to create and draw crescent or gibbous moon shapes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
moonGrob(
  x,
  y,
  ratio = 0.25,
  right = TRUE,
  r = 10,
  angle = 0,
  default.units = "npc",
  size.units = "mm",
  ...
)

grid.moon(..., draw = TRUE)

Arguments

x

A numeric vector or unit object specifying x-locations.

y

A numeric vector or unit object specifying y-locations.

ratio

A numeric vector with values from 0 to 1 specifying the proportion of the moons to draw.

right

A boolean vector specifying whether the moon should be filled from the right (TRUE) or left (FALSE).

r

A numeric vector specifying the radii of the circles describing the moons.

angle

Not used.

default.units

A string indicating the default units to use if x, y, width, or height are only given as numeric vectors.

size.units

A string indicating the units to use for the radii of the moons.

...

Arguments passed on to grid::polygonGrob.

draw

A logical value indicating whether graphics output should be produced.

Details

Both functions create a moon grob (a graphical object describing a crescent or gibbous moon), but only grid.moon draws the moon (and then only if draw is TRUE).

These functions calculate a set of points describing the perimeters of the moons and pass these points on to grid::polygonGrob.

The units in default.units and size.units can be different; grid will add them together appropriately before drawing.

Value

A grob object.

Examples

1
2
grid::grid.newpage()
grid.moon(x = 1:3 * 0.25, y = rep(0.5, 3), ratio = 1:3 * 0.25, r = 10)

gggibbous documentation built on Jan. 13, 2021, 6:51 a.m.