I am trying to resize a plotlyOutput in a shiny app but changing the height parameters doesnt seem to affect the plot size, after updating today to R 3.4 and updating shiny, and plotly (plotly_4.7.0, ggplot2_2.2.1.9000, shiny_1.0.3 ) I realized that the size of the plot does not change dynamically when resizing the window. I have tried modifying the size of the plot directly using height in plotlyoutput, as well as modifying the $layout$height property from the plotly object,t but it doesnt seem to have any effect on the size of the plots. Here is a sample code.
ui<-fluidPage(
mainPanel(
tabsetPanel(
tabPanel("tab",
selectInput("plot","Plot type",c("Box plot"="box","Inidividual cells"="cell","Violin plot"="violin"),"violin"),
plotlyOutput('Barplot',height = "100px")
)
)
)
)
server<- function(input,output,session){
output$Barplot <- renderPlotly({
bp <- ggplot(mtcars,aes(x=cyl,y=mpg,colour=cyl))+geom_point()
bp<-plotly_build(bp)
bp$layout$width= 100
bp
})
}
shinyApp(server=server,ui=ui)