R Shiny HTMLWidget用于交互式3D直方图 [英] R Shiny HTMLWidget for interactive 3D-histograms
问题描述
我想在R Shiny应用程序中包括3D dynamic (即可以通过移动图来改变其视角)直方图小部件。
不幸的是,直到现在我还没有找到任何东西。
到目前为止,我的搜索结果:使用threejs(例如此处在CRAN和那里),可以使用许多不同的表示形式(散点图,表面等),但不能使用 3D 直方图。 plot3D和plot3Drgl没有任何R Shiny副本。
除非已经存在,否则我打算从 vis.js ,即 graph3d 。
您对此问题有何看法?
最诚挚的问候,
奥利维尔
plot3Drgl
code>。这是一个示例。
library(plot3Drgl)
库(发光)
选项(rgl.useNULL = TRUE)
ui<-fluidPage(
rglwidgetOutput( myWebGL)
)
服务器<-function(输入,输出){
保存<-选项(rgl.inShiny = TRUE)
on.exit(选项(保存))
output $ myWebGL<-renderRglwidget({
try(rgl.close())
V<-volcano [seq(1,nrow(volcano),by = 5),
seq(1,ncol(volcano),by = 5) ]#较低分辨率
hist3Drgl(z = V,col =灰色,边框=黑色,照明= TRUE)
rglwidget()
})
}
ShinyApp(ui,服务器)
I would like to include a 3D dynamic (i.e. one can change its perspective just by moving the plot) histogram widget in a R Shiny application.
Unfortunately I didn't find any until now.
So far the results of my searches: with threejs (e.g. here on CRAN and there on GitHub) one can use many different representations (scatterplots, surfaces, etc.) but no 3D histogram. plot3D and plot3Drgl don't have any R Shiny counterpart.
Unless something already exists my intention is to create an HTMLWidget from one of the sub-libraries of vis.js, namely graph3d.
What are your views on this issue?
Best regards,
Olivier
It's possible with plot3Drgl
. Here is an example.
library(plot3Drgl)
library(shiny)
options(rgl.useNULL = TRUE)
ui <- fluidPage(
rglwidgetOutput("myWebGL")
)
server <- function(input, output) {
save <- options(rgl.inShiny = TRUE)
on.exit(options(save))
output$myWebGL <- renderRglwidget({
try(rgl.close())
V <- volcano[seq(1, nrow(volcano), by = 5),
seq(1, ncol(volcano), by = 5)] # lower resolution
hist3Drgl(z = V, col = "grey", border = "black", lighting = TRUE)
rglwidget()
})
}
shinyApp(ui, server)
这篇关于R Shiny HTMLWidget用于交互式3D直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!