0
J'utilise R Shiny pour visualiser les données sous forme de camemberts en utilisant le paquetage Plotly. Le problème est que je voudrais redimensionner les camemberts et naviguer horizontalement pas verticalement, l'image est montrée ci-dessous.Comment réorganiser les graphiques dans R Shiny?
J'apprécierai pour aider les experts!
Voici le code
#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)
})