2、画散点图,通过geom_label显示标签信息 data.plot%>%ggplot(aes(x,y))+geom_point(aes(colour=Class),size=0.5)+scale_colour_brewer(palette="Dark2")+theme_bw()+ggtitle("Class.cluster.plot")+theme(plot.title=element_text(face=2,size=50,hjust=0.5))+geom_label(data=label.data,aes(label=...
geom_boxplot( mapping = NULL, data = NULL, stat = "boxplot", position = "dodge2", ..., outliers = TRUE, outlier.colour = NULL, outlier.color = NULL, outlier.fill = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, outlier.alpha = NULL, notch = FALSE, notc...
geom_point(data=df,aes(x=PC1,y=PC2, color=group,shape=group), size=2) 1. 2. 3. 4. 5. image.png 接下来是一些简单的美化 ggplot()+ geom_point(data=df,aes(x=PC1,y=PC2, color=group,shape=group), size=3)+ theme_bw()+ theme(panel.background = element_blank(), panel.grid =...
scale_color_gradient(low = "green", high = "red") -用scale_color_distiller()设置调色板中的颜色 #图2 scale_color_distiller()函数 ggplot(mpg, aes(displ, hwy, color = hwy)) + geom_point() + scale_color_distiller(palette = "Set1") 2)离散变量 -用scale_color_manual()手动设置颜色,还...
基本的散点图,根据group分组来映射颜色和形状 library(ggplot2)ggplot()+geom_point(data=df,aes(x=PC1,y=PC2,color=group,shape=group),size=2) image.png 接下来是一些简单的美化 ggplot()+geom_point(data=df,aes(x=PC1,y=PC2,color=group,shape=group),size=3)+theme_bw()+theme(panel.backgroun...
要求数据源的y能够被分组,每组不止一个元素, 或增加一个分组映射,即aes(x= , y = , group = ) library(Hmisc) g <-ggplot(mtcars,aes(cyl, mpg)) +geom_point()#mean对mtcars中的列变量进行运算,返回均值 g +stat_summary(fun.y = "mean", color = "red", size =2) ...
1.属性设置 fill管实心,color管边框 1.1手动设置,需要设置为有意义的值library(ggplot2) ggplot(data = iris) +geom_point(mapping...#这里color是geom_point的参数,即:把图形设置为一个或n个颜色,与数据内容无关 图片 图片 1.2 映射:按照数据框的某一列来定义图的某个属性 ggplot(data = iris)+...) #...
kegg_point + theme(legend.key=element_blank())
qplot(x=mpg, y=wt, data=df, geom = "point") 在ggplot中完全可以如下实现: ggplot(data=df, aes(x=mpg, y=wt))+ geom_point 改变点形状、大小、颜色等属性 ggplot(data=df, aes(x=mpg, y=wt))+geom_point(color="blue", size=2, shape=23) 绘图过程中常常要用到转换(transformation...
d<-ggplot(diamonds,aes(carat,price))d+geom_point(alpha=1/10)d+geom_point(alpha=1/20)d+geom_point(alpha=1/100)# You can create interesting shapes by layering multiple pointsof# different sizes p<-ggplot(mtcars,aes(mpg,wt))p+geom_point(colour="grey50",size=4)+geom_point(aes(colour...