在google搜索了一下,这方面介绍的好帖子太多了,真是好感动!我直接总结转载即可:
很具有参考学习价值的帖子如下:
(1)ggplot更多的画图细节--坐标轴和图例:http://blog.youkuaiyun.com/duqi_yc/article/details/12362085
(2)qplot的学习:http://blog.youkuaiyun.com/duqi_yc/article/details/12178463
(3)qplot的官方介绍:http://docs.ggplot2.org/0.9.3/qplot.html
=====================================================
以我的一个实际分析代码为例(具体见上一篇博文“ggplot2画boxplot的学习和总结”):
ups
require(reshape2);
require(ggplot2);
ups.melt
p
aes(x=flag,y=value))+geom_boxplot(aes(fill=variable));
#p+ facet_wrap(~ variable, scales="free");
#分别把LFQ、MQ、PANDA画在三个boxplot中
#p+ facet_wrap(~ flag, scales="free"); #分别B/A, C/B, D/C,
E/D把画在四个boxplot中
p
p
ggtitle("22 commonly quantified UPS1 proteins");
#添加横纵坐标名称,添加图的名称
p
#添加legend名称
p + scale_x_continuous(limits = c(-5,15)) ## x-axis范围设置方法一
p + xlim(-5,15) ## x-axis范围设置方法二
windowsFonts(myFont=windowsFont("Arial")) #要修改字体,先要初始化字体
#对x、y轴name做修改
p+theme(axis.title= element_text(size=15, family="myFont",
color="black", face= "bold", vjust=0.5, hjust=0.5))
#仅对y轴name做修改:
p+theme(axis.title.y= element_text(size=15, family="myFont",
color="black", face= "bold", vjust=0.5, hjust=0.5))
#仅对y轴的刻度做修改:
p+theme(axis.text.y= element_text(size=15, family="myFont",
color="black", face= "bold", vjust=0.5, hjust=0.5))
#对图片的title做修改
p+theme(title= element_text(size=15, family="myFont",
color="black", face= "bold", vjust=0.5, hjust=0.5))
#对legend的内容做修改
p+theme(legend.text= element_text(size=15, family="myFont",
color="black", face= "bold", vjust=0.5, hjust=0.5))
vjust和hjust是对图中文字label位置的设置,这里其实