使用闪亮时不会出现密谋

时间:2019-06-13 20:29:57

标签: r shiny plotly heatmap

我正在尝试使用滑块绘制热图。滑块会显示,但不会显示热图。当不与闪亮效果一起使用时,热图绘制就很好。在某一时刻,我可以使用该代码,但是此后我又破坏了它,我不知道该怎么做。

library(gplots)
library(plotly)
library(shiny)


#Ui
ui <- fluidPage(
titlePanel("Example"),
sidebarLayout(
sidebarPanel(
sliderInput(inputId = "P4Volume",
              label = "Example:",
              min = 50000,
              max = 1200000,
              value = 30)
),
mainPanel(
    plotlyOutput(outputId = "heatmap"),
)
)
)

#Server
server <- function(input, output) {
output$heatmap <- renderPlotly({

*Code here that takes input$P4Volume and creates a matrix z

plot_ly(z,x,y,type= "heatmap",width=800,height=600)
})
}
shinyApp(ui, server)

我什至尝试了一个非常简单的示例,其中不包含滑块,而仅包含可绘制的图:

library(shiny)
library(plotly)

x=seq(0,10,2)
y=seq(0,10,2)
z=matrix(100,nrow=6,ncol=6)
p=plot_ly(z=z, x = x, y =y,type="heatmap")

ui <- fluidPage(
plotlyOutput("plot")
)

server <- function(input, output) {
output$plot <- renderPlotly({p})
}
shinyApp(ui, server)

我仍然没有得到一个热图,但是当我将其绘制在攀爬之外时,它的绘制效果很好...

1 个答案:

答案 0 :(得分:0)

结果证明它在chrome中有效,但在IE中不起作用。将我的浏览器从R更改为chrome,现在一切看起来都很好!