前面也给出了一些ggplot2绘制生信分析基本图形的例子pheatmap|暴雨暂歇,“热图”来袭!!!,ggplot2-plotly|让你的火山图“活”过来,ggplot2|扩展包从0开始绘制雷达图,ggplot2| 绘制KEGG气泡图,ggplot2|绘制GO富集柱形图,ggplot2|从0开始绘制PCA图,ggplot2|ggpubr进行“paper”组图合并,本文将
library(reshape2) # for melt df <- melt(outer(1:4, 1:4), varnames = c("X1", "X2")) p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value)) p2 <- p1 + geom_point(aes(size = value)) # Basic form p1 + scale_fill_continuous(guide = "legend")p1 + scale_fi...
前面也给出了一些ggplot2绘制生信分析基本图形的例子pheatmap|暴雨暂歇,“热图”来袭!!!,ggplot2-plotly|让你的火山图“活”过来,ggplot2|扩展包从0开始绘制雷达图,ggplot2| 绘制KEGG气泡图,ggplot2|绘制GO富集柱形图,ggplot2|从0开始绘制PCA图,ggplot2|ggpub...
p +labs(title="Plot of length \n by dose", x ="Dose (mg)", y = "Teeth length") It is also possible to change legend titles using the function labs(): # Default plot p <- ggplot(ToothGrowth, aes(x=dose, y=len, fill=dose))+ geom_boxplot() p # Modify legend titles p + ...
# 去除legend title p + theme(legend.title = element_blank()) # 去除整个legend p + theme(legend.position='none') guides 设置specific aesthetic 使用guides()参数来设置或移除特定的美学映射(fill, color, size, shape等). 因子变量cyl和gear映射为点图的颜色和形状,qsec决定点的大小。 p <- ggplot(...
#gear为横坐标,对mpg做箱线图,gear填充颜色p<-ggplot(mtcars, aes(x=gear, y=mpg, fill=gear)) +geom_boxplot()p 设置legend position 使用theme() 参数设置legend位置 # 可选参数为“left”,“top”, “right”, “bottom”.p+theme(legend.position="bottom") ...
改变Legend title的样式 p = ggplot(PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot() p + theme(legend.title=element_text(face="italic", family="Times", colour="red",size=14)) 5.修改尺寸大小 p+theme(legend.background=element_rect(colour="purple",fill="pink",size=...
p <- ggplot(b,aes(x=id,y=a,color=new,shape = new))+geom_point(size=2) p2 <- p + ggtitle(label ="shape colour")+ theme(plot.title = element_text(lineheight=.8, size=10, face="bold",hjust = 0.5)) + theme(legend.title=element_text(face="bold",size=8)) + theme(legend...
bp<-ggplot(data=PlantGrowth,aes(x=group,y=weight,fill=group))+geom_boxplot() bp 移除图例 Use guides(fill=FALSE), replacing fill with the desired aesthetic. 使用guides(fill=FALSE)移除由ase中 匹配的fill生成的图例, 也可以使用themeYou can also remove all the legends in a graph, using theme...
ggplot2中的legend包括四个部分:legend.tittle, legend.text, legend.key, legend.backgroud。针对每一部分有四种处理方式: element_text()绘制标签和标题,可控制字体的family, face, colour, size, hjust, vjust, angle, lineheight,当改变角度时,序将hjust调整至0或1. ...