Ошибка rgl.snapshot
при использовании исправленной (install_github("rgl", "trestletech", "js-class")
) версии rgl с Shiny.
rgl.snapshot
работает с rgl >= 0.95.1247. Однако из-за известной проблемы, связанной с тем, что последний rgl не работает с блестящим, вывод будет таким, как указано в этом ticket, а снимки — это просто пустые/черные изображения.
Вот воспроизводимый пример, взятый из shinyRGL github:
сервер.R
library(shiny)
library(shinyRGL)
#' Define UI for application that plots random 3d points
#' @author Jeff Allen \email{jeff@@trestletech.com}
shinyUI(pageWithSidebar(
# Application title
headerPanel("Shiny WebGL!"),
# Sidebar with a slider input for number of points
sidebarPanel(
sliderInput("pts",
"Number of points:",
min = 10,
max = 1000,
value = 250),
HTML("<hr />"),
helpText(HTML("Created using <a href = \"http://github.com/trestletech/shinyRGL\">shinyRGL</a>."))
),
# Show the generated 3d scatterplot
mainPanel(
webGLOutput("sctPlot")
)
))
ui.R
# Must be executed BEFORE rgl is loaded on headless devices.
options(rgl.useNULL=TRUE)
library(shiny)
library(shinyRGL)
library(rgl)
xPts <- runif(1000, 0, 1)
yPts <- runif(1000, 0, 1)
zPts <- runif(1000, 0, 1)
#' Define server logic required to generate and 3d scatterplot
#' @author Jeff Allen \email{jeff@@trestletech.com}
shinyServer(function(input, output) {
# Expression that generates a rgl scene with a number of points corresponding
# to the value currently set in the slider.
output$sctPlot <- renderWebGL({
points3d(xPts[1:input$pts],
yPts[1:input$pts],
zPts[1:input$pts])
axes3d()
rgl.snapshot('./test.png', fmt = 'png')
})
})
вышел
Warning in rgl.snapshot("./test.png", fmt = "png") : snapshot failed
Информация о сеансе
# sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.4 (Santiago)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shinyRGL_0.1.1 shiny_0.12.2 rgl_0.93.963
loaded via a namespace (and not attached):
[1] R6_2.1.1 htmltools_0.2.6 Rcpp_0.12.0 digest_0.6.8
[5] xtable_1.7-4 httpuv_1.3.3 mime_0.3
Любая помощь горячо приветствуется.