This is used for example by plot3js() to add axis grids to a plot these show along the faces of the plotting box, indicating axis ticks.

grid3js(
  data3js,
  sides = c("x", "y", "z"),
  axes = c("x", "y", "z"),
  at = NULL,
  dynamic = TRUE,
  col = "grey95",
  lwd = 1,
  geometry = FALSE,
  ...
)

Arguments

data3js

The data3js object

sides

The axis sides to show the box, any combination of "x", "y" or "z"

axes

Axes for which to draw the grid lines

at

Where to draw grid lines along the axis

dynamic

Should edges of the box closest to the viewer hide themselves automatically

col

Grid line color

lwd

Grid line width

geometry

Should the lines be rendered as a physical geometry in the scene (see lines3js())

...

Other arguments to pass to material3js()

Value

Returns an updated data3js object

See also

Examples

# Setup blank base plot
p <- plot3js(draw_grid = FALSE, xlab = "X", ylab = "Y", zlab = "Z")

# Add a box
p <- box3js(p)

# Add grid lines but only for the z axis
p <- grid3js(
  p, col = "red",
  axes = "z"
)

r3js(p)
# Add grid lines but only for the z axis and # only at either end of the x axis p <- grid3js( p, col = "blue", axes = "z", sides = "x" ) r3js(p)