r - How to put two plotly graphs in one row? -


i have multiple pie graphs plotly in shiny app , cannot seem move them fit in same row. can move them around either changing position in .css file or using absolutepanel() either option leaves me giant chunk of empty white space @ bottom. cannot post code app made smaller example in tried moving column() function no avail. appreciated. in actual app have 5 graphs amount of white space big , wish resolve it. might easy answer bear me guys im newb...

library(shiny) library(plotly)   ui = fluidpage(   plotlyoutput("graph1",width="40%",height="350px"),   column(width=12,offset=4,plotlyoutput("graph2",width="40%",height="350px")) ) server = function(input, output,session) {      output$graph1<-renderplotly({      uspersonalexpenditure <- data.frame("categorie"=rownames(uspersonalexpenditure), uspersonalexpenditure)     data <- uspersonalexpenditure[,c('categorie', 'x1960')]      p <- plot_ly(data, labels = ~categorie, values = ~x1960, type = 'pie') %>%       layout(title = 'graph 1',              xaxis = list(showgrid = false, zeroline = false, showticklabels = false),              yaxis = list(showgrid = false, zeroline = false, showticklabels = false))    })   output$graph2<-renderplotly({     uspersonalexpenditure <- data.frame("categorie" = rownames(uspersonalexpenditure), uspersonalexpenditure)     data <- uspersonalexpenditure[, c('categorie', 'x1960')]      colors <- c('rgb(211,94,96)', 'rgb(128,133,133)', 'rgb(144,103,167)', 'rgb(171,104,87)', 'rgb(114,147,203)')      p <- plot_ly(data, labels = ~categorie, values = ~x1960, type = 'pie',                  textposition = 'inside',                  textinfo = 'label+percent',                  insidetextfont = list(color = '#ffffff'),                  hoverinfo = 'text',                  text = ~paste('$', x1960, ' billions'),                  marker = list(colors = colors,                                line = list(color = '#ffffff', width = 1)),                  #the 'pull' attribute can used create space between sectors                  showlegend = false) %>%       layout(title = 'graph 2',              xaxis = list(showgrid = false, zeroline = false, showticklabels = false),              yaxis = list(showgrid = false, zeroline = false, showticklabels = false))    }) }  # run application  shinyapp(ui = ui, server = server) 

you try using fluidrow , segment columns in below. columns space base 12, 2 column(6,..) calls within 1 fluidrow split two. example below splits 4. i'm not clear on "white space @ bottom" issue describe, may not fix you're after.

ui = fluidpage( fluidrow(     column(3,            plotlyoutput("graph1")            ),     column(3,            plotlyoutput("graph2")            ),     column(3,            plotlyoutput("graph3")            ),     column(3,            plotlyoutput("graph4")            ) ) ) 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -