设为首页收藏本站获取积分奖励

R语言中文网

 找回密码
 立即注册
查看: 4021|回复: 0

[实例投稿提交] BMW logo in ggplot2

[复制链接]
发表于 2016-3-30 15:44:10 | 显示全部楼层 |阅读模式
初次接触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)

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Archiver|R语言中文网    

GMT+8, 2024-6-3 09:41 , Processed in 0.035982 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表