@Macux
2015-12-01T06:46:35.000000Z
字数 816
阅读 902
R语言_学习笔记
> p1 <- ggplot(heightweight,aes(ageYear,heightIn)) + geom_point(shape=8,color="black")
> p1 + ggtitle("Age and Height of Schoolchildren") +theme(plot.title=element_text(color="steelblue"))
#ggtitle()与labs(title=) 等价
> p1 + geom_text(aes(label=weightLb,y=heightIn+0.3),size=3,alpha=0.7,fontface="bold",color="maroon1")
(1)、图例篇
> p3 <- ggplot(heightweight,aes(ageYear,heightIn,color=sex)) + geom_point()
> p3 + theme(
legend.background=element_rect(fill="grey80",color="red",size=1),
legend.title=element_text(color="blue",face="bold",size=14),
legend.text=element_text(color="red"),
legend.key=element_rect(color="blue",size=0.25)) #图例最里面小正方形的边框颜色。
(2)、分面篇
> p3 + facet_grid(sex~.) + theme(strip.background=element_rect(fill="navajowhite"),
strip.text.y=element_text(size=14,face="bold",angle=-45))