triangle3js | R Documentation |
Add a triangle to a data3js object
triangle3js(data3js, vertices, col = "black", highlight, ...)
data3js |
The data3js object |
vertices |
An nx3 matrix of triangle vertices |
col |
Single color for the triangles or vector of vertex colors |
highlight |
highlight attributes (see |
... |
Additional attributes to pass to |
Returns an updated data3js object
Other plot components:
arrows3js()
,
axis3js()
,
box3js()
,
grid3js()
,
legend3js()
,
light3js()
,
lines3js()
,
mtext3js()
,
points3js()
,
segments3js()
,
shape3js()
,
sphere3js()
,
surface3js()
,
text3js()
# Draw some random triangles
M <- matrix(
data = rnorm(36),
ncol = 3,
nrow = 12
)
p <- plot3js(
xlim = range(M[,1]),
ylim = range(M[,2]),
zlim = range(M[,3]),
label_axes = FALSE
)
p <- triangle3js(
p,
vertices = M,
col = rainbow(nrow(M))
)
r3js(p, zoom = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.