我知道以前有人问过这个问题,但在使用过去的一些答案时,我仍然无法生成我想要的雷达图。我用过这个,
as an example of a radar chart I am trying to reproduce.
但我似乎不知道最后一点。
到目前为止,我的情况是:
我对以下情况感到不满:
1.背景上的极坐标网格。我该怎么做才能让它穿过每个吧台的中间?一开始看起来是这样,但后来停了下来,我不知道为什么。如果我不能让它穿过中间,那么我想让它穿过每个酒吧的外面。如果这不管用,那就把雷达图切成8等分吧?
2.为什么有些钢筋之间有宽度,而有些钢筋之间没有那么宽。
代码:
t<-12
angle_bucket<-seq(0,2*pi-2*pi/t,2*pi/t)
angle_group<-seq(1,length(angle_bucket),1)
meanL<-c(17.289,20.7857,18.675,10.4,0,0,22.1,19.5,18.02,19.5,30.35,29.83)
normized<-c(1,0.368,0.2105,0.05263,0,0,0.10526,0.21056,0.5263,0.157894,0.7368,0.8421)
ang_dfp<-data.frame(angle_bucket,angle_group,meanL,normized)
ang_dfp$angle_group<-as.factor(ang_dfp$angle_group)
ang_dfp$angle_bucket<-ang_dfp$angle_bucket+2*pi/t/2
p<-ggplot()+
geom_bar(data=ang_dfp,aes(x=angle_bucket,y=normized, fill=meanL), stat = "identity")+
scale_fill_viridis_c(alpha=1,begin=0,end=1,direction=-1,option='plasma',aesthetics ='fill')+
scale_x_continuous(breaks = 0:nlevels(ang_dfp$angle_group))+
#Theme
theme_minimal()+
theme(
panel.background = element_rect(fill = "transparent", colour = NA),
axis.title = element_blank(),
axis.ticks = element_blank(),
axis.text=element_blank(),
axis.line=element_blank(),
plot.margin = unit(c(0.1,0.1,0.1,0.1), "cm"),
plot.background = element_rect(fill = "transparent", colour = NA),
legend.position = 'none'
)+
coord_polar(theta='x',start=0,direction=-1)
p