grid3js {r3js} | R Documentation |
Add axis grids to an data3js object
Description
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.
Usage
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 |
... |
Other arguments to pass to |
Value
Returns an updated data3js object
See Also
Other plot components:
arrows3js()
,
axis3js()
,
box3js()
,
legend3js()
,
light3js()
,
lines3js()
,
mtext3js()
,
points3js()
,
segments3js()
,
shape3js()
,
sphere3js()
,
surface3js()
,
text3js()
,
triangle3js()
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)