2017-06-21 11 views
0

私はPlotlyパッケージを使っていくつかの円グラフとしてデータを視覚化するためにR Shinyを使用しています。問題は、円グラフのサイズを変更して、縦方向ではなく横方向に移動したいということです。画像は下に示されています。Rシャイニーでチャートを再編成するには?

私は専門家の助けに感謝します!ここで

はコード

#UI part 
dashboardBody(
fluidRow(
    plotlyOutput("PieDistribution"), 
    plotlyOutput("PieHealth") 
) 

#server part 
output$PieDistribution <- renderPlotly({ 
plot_ly(PD, labels = ~PD$VP, values = ~PD$V1, type = 'pie', 
     textposition = 'inside', 
     textinfo = 'percent', 
     insidetextfont = list(color = '#FFFFFF'), 
     hoverinfo = 'text', 
     text = ~paste(PD$VP), 
     marker = list(colors = colors, 
         line = list(color = '#FFFFFF', width = 1))) %>% 
    layout(title = 'Project Distribution by Vice President', 
     xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE), 
     yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE), 
     showlegend = FALSE, 
     legend = list(x = 50, y = 0.5)) 
    }) 

output$PieHealth <- renderPlotly({ 
plot_ly(PD2, labels = ~PD2$HealthName, values = ~PD2$V1, type = 'pie', 
     textposition = 'inside', 
     textinfo = 'percent', 
     insidetextfont = list(color = '#FFFFFF'), 
     hoverinfo = 'text', 
     text = ~paste(PD2$HealthName), 
     marker = list(colors = c('#229954', '#d32f2f','#ffc107'), 
         line = list(color = '#FFFFFF', width = 1))) %>% 
    layout(title = "Project Health", 
     xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE), 
     yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE), 
     showlegend = FALSE) 
}) 

Image of the pie charts

答えて

1

があなたのUIでfluidrow内に新しい列を作成しています。次のようなもの:

fluidRow(column(6, 
    plotlyOutput("PieDistribution")), 
column(6, 
    plotlyOutput("PieHealth")) 
) 
関連する問題