gg3d_add_grid_lines: Add grid lines to ggplot perspective plot

View source: R/main.R

gg3d_add_grid_linesR Documentation

Add grid lines to ggplot perspective plot

Description

Add grid lines to a ggplot perspective plot.

Usage

gg3d_add_grid_lines(
  myplot,
  x = seq(0, 1, 0.1),
  y = c(0, 1),
  z = 0,
  proj_mat,
  col = grey(0.8),
  size = 0.5,
  break_axis = NULL
)

Arguments

myplot

an object of class ggplot.

x, y, z

coordinates of lines. Values must be a sequence of breaks or a pair of start-end values or a single value (see details).

proj_mat

4*4 projection matrix, as returned from get_projection().

col

line colour.

size

line size.

break_axis

which axis to apply breaks over. If NULL then chosen automatically from other inputs, otherwise must be one of "x", "y" or "z" (see details).

Details

The vectors x, y, and z together define the locations and orientations of the lines. One of these vectors must be a series of breaks, one must be a limit (i.e. a vector of two values) and one must be a single value. For example, if x = 1:5, y = c(-1,1), z = 3 then lines will be drawn parallel to the y-axis at x-values 1:5, spanning a range -1 to 1, and in the z-plane at position z = 3. If there are only two breaks then it becomes impossible to determine which axis represents breaks and which represents limits, hence the argument break_axis must be specified (otherwise this is chosen automatically).


bobverity/bobfunctions2 documentation built on July 4, 2023, 8:55 p.m.