Is there a way to center an R plot within a tabPanel in shiny? -
i working on shiny app, , way have formatted plots way wide. shortened them width argument reasonable can't figure out how center them within tab panel (apparently plotoutput doesn't take align argument).
tabsetpanel( tabpanel("plot1", plotoutput("plot1", width="60%")), tabpanel("plot2", plotoutput("plot2", width="60%")) )
i not aware of shiny specific way can use css style output images. add tags$style
following content ui:
"#plot1 img, #plot2 img { width: 60%; display: block; margin-left: auto; margin-right: auto; }"
and remove width="60%"
plotoutput
. excluding width
bootstrap center-block class. minimal ui definition this:
shinyui(bootstrappage( tags$head(tags$style( type="text/css", "#plot1 img, #plot2 img { width: 60%; display: block; margin-left: auto; margin-right: auto; }" )), tabsetpanel( tabpanel("plot1", plotoutput("plot1")), tabpanel("plot2", plotoutput("plot2")) ) ))
Comments
Post a Comment