Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用plotly和Shining server复制图例条目_R_Shiny_Plotly_Shiny Server - Fatal编程技术网

使用plotly和Shining server复制图例条目

使用plotly和Shining server复制图例条目,r,shiny,plotly,shiny-server,R,Shiny,Plotly,Shiny Server,我想在R中绘制数据,这样用户可以选择要绘制的实例(哪些因子级别)。我想做它使用,然后主机使用 问题是,在更新所选内容后(即第一次正确渲染时,但在单击另一个变量进行打印后,出现问题),每个图例条目都会重复两次 以下是示例: 奇怪的是,在本地运行(例如,在R Studio内部或使用runApp())或使用shinyapps.io时,此问题并不存在,而仅在使用Shiny Server.R时才存在 有没有办法解决这个问题并避免重复条目 可复制示例: library(plotly) ui该问题是由普通用

我想在R中绘制数据,这样用户可以选择要绘制的实例(哪些因子级别)。我想做它使用,然后主机使用

问题是,在更新所选内容后(即第一次正确渲染时,但在单击另一个变量进行打印后,出现问题),每个图例条目都会重复两次

以下是示例:

奇怪的是,在本地运行(例如,在R Studio内部或使用
runApp()
)或使用shinyapps.io时,此问题并不存在,而仅在使用Shiny Server.R时才存在

有没有办法解决这个问题并避免重复条目

可复制示例:

library(plotly)

ui该问题是由普通用户和闪亮用户的plotly软件包的不同版本引起的。闪亮服务器(至少默认情况下)在“闪亮”用户下运行,但当您在本地运行应用程序时,它将在当前用户下运行。因此,这两种运行应用程序的方式使用不同的软件包版本


此外,CRAN上提供的稳定plotly版本(
plotly_4.5.6
)中不存在此问题。

我已在mac笔记本电脑上本地测试了您的代码,无法重现图例问题。使用Chrome、Firefox和Safari进行测试。My sessionInfo:R版本3.3.3(2017-03-06),平台:x86_64-apple-darwin13.4.0(64位),运行于:OS X El Capitan 10.11.6,plotly_4.5.6,ggplot2_2.2.1,Shirning_1.0.0。@bdemarest补充了在本地运行时不存在问题的说明(使用
runApp()
),但仅当使用Shining Server时。可能还应包括
sessionInfo()
数据。
R version 3.3.2 (2016-10-31) 
Platform: x86_64-pc-linux-gnu (64-bit) 
Running under: Arch Linux 

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] plotly_4.5.6.9000 ggplot2_2.2.1.9000 shiny_1.0.0 

loaded via a namespace (and not attached): 
[1] Rcpp_0.12.9 magrittr_1.5 munsell_0.4.3 viridisLite_0.1.3 
[5] colorspace_1.3-2 xtable_1.8-2 R6_2.2.0 httr_1.2.1 
[9] plyr_1.8.4 dplyr_0.5.0 tools_3.3.2 grid_3.3.2 
[13] gtable_0.2.0 DBI_0.5-1 crosstalk_1.0.0 htmltools_0.3.5 
[17] yaml_2.1.14 lazyeval_0.2.0 digest_0.6.12 assertthat_0.1 
[21] tibble_1.2 tidyr_0.6.1 purrr_0.2.2 base64enc_0.1-3 
[25] htmlwidgets_0.8 mime_0.5 scales_0.4.1 jsonlite_1.3 
[29] httpuv_1.3.3