初次接触ggplot2,恳请各位大神指正!
library(grid)
library(ggplot2)
windowsFonts(A=windowsFont("MS UI Gothic"),
D=windowsFont("Rockwell"))
H=1.8
df<-data.frame(ID=LETTERS[1:4],value=c(0,1,0,1),type=c("W","B","W","B"))
ggplot(df,aes(ID,value,fill=type,colour="grey15"))+
geom_bar(stat="identity",width=1)+
geom_hline(y=1,size=0.3)+
geom_hline(y=H,size=0.3)+
geom_hline(y=(1+H)/2,size=33.3,xlim=c(-5,5),linetype="solid")+
geom_text(label="B",x=3.9,y=(1+H)/2,size=31.5,angle=50,family="A",colour="white")+
geom_text(label="M",x=4.5,y=(1+H)/2,size=31.5,family="A",colour="white")+
geom_text(label="W",x=5.1,y=(1+H)/2,size=31.5,angle=-50,family="A",colour="white")+
scale_fill_manual(values=c("steelblue1","white"))+
theme(plot.background=element_blank(),
panel.background=element_blank(),
axis.ticks=element_blank(),
panel.grid.major=element_line(colour=NA),
panel.grid.minor=element_line(colour=NA),
axis.text.y=element_blank(),
axis.text.x=element_blank(),
legend.position="NULL",
plot.title=element_text(vjust=-59,size=20)
)+xlab("")+ylab("")+
coord_polar()+
labs(title="Sheer \n Driving Pleasure",face="D")
ggsave("BMW.tiff",height=7,width=7)
|