我创建了多面饼图,它从下拉菜单中响应用户输入,并且正在努力寻找一种标记它们的整洁方式。我尝试过这里使用的方法:R Shiny:饼图缩小后……
output$indBar <- renderPlot({ indplot<-ggplot(df.ind.calc(), #subset(df.ind.cal,df.ind.cal$Elect_div==input$division), aes(x = "",y=pct_value, fill = variable2))+ geom_bar(width = 1,stat="identity")+ facet_grid(~variable3)+ coord_polar(theta = "y")+ labs(title= "Industry of employment", color="Industries", x="", y="")+ theme_void()+ geom_text(aes(x=1.6,label = perc_text), size = 4,position = position_stack(vjust = 0.5))+ ###SOLUTION for labeling### guides(fill = guide_legend(title="",nrow=3,byrow=TRUE))+ theme(legend.position="bottom")+ scale_fill_brewer(palette = "RdBu", labels=c("Agri/Forest/Fish","Arts & Rec","Finance & Insurance","Health", "Logistics","Media & Telecomms","Mining","Public Admin & Safety", "Real estate", "Retail","Science & tech"))+ theme(plot.title = element_text(size = 20,hjust = 0.5),strip.text = element_text(size = 15), legend.text=element_text(size=13)) indplot})