Description Usage Arguments Details See Also Examples
Output and render functions for using aDataScene within Shiny applications.
1 2 3 | aDataSceneOutput(outputId, ..., skipDependencies = FALSE)
renderADataScene(expr, env = parent.frame(), quoted = FALSE)
|
outputId |
output variable to read from |
... |
Attributes, A-Frame components, and/or child elements for output in HTML. |
skipDependencies |
Option to omit packaged A-Frame JavaScript libraries. See details. |
expr |
An expression that returns a call to |
env |
The environment in which to evaluate |
quoted |
Is |
A-Frame v0.7.1, gg-aframe v0.2.3, and
aframe-environment-component v1.0.0 come packaged with
shinyaframe. To use different versions, set skipDependencies
to TRUE
and source the libraries directly (for
example with includeScript
or
tag
).
'gg-aframe' syntax documentation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Simple 3D scatterplot.
# See package vignette for additional asethetics, guides, and legends
if (interactive()) {
library(dplyr)
library(shiny)
library(scales)
shinyApp(
ui = fluidPage(
aDataSceneOutput(
outputId = "mydatascene",
# gg-aframe plot syntax
atags$entity(
plot = "", position = "0 1.6 -1.38", rotation = "0 45 0",
atags$entity(
`layer-point` = "", `mod-oscillate` = "",
`data-binding__sepal.length`="target: layer-point.x",
`data-binding__sepal.width`="target: layer-point.y",
`data-binding__petal.length`="target: layer-point.z",
# add 4th positional by animating y position between two mappings
`data-binding__petal.width`="target: mod-oscillate.y",
`data-binding__species`="target: layer-point.shape"
)
)
)
),
server = function(input, output, session) {
output$mydatascene <- renderADataScene({
names(iris) <- tolower(names(iris))
iris %>%
# scale positional data
mutate_if(is.numeric, rescale) %>%
aDataScene()
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.