方法2 gghalves library(gghalves)ggplot(iris,aes(x=Species,y=Sepal.Width))+geom_half_point()+geom_point()head(my_data)ggplot()+geom_half_violin(data=my_data%>%filter(x=="a"& m=="i"),aes(x=x,y=y,fill=m),side="l")+geom_half_violin(data=my_data%>%filter(x=="a"& m=="j...
这里主要介绍这个包中的geom_half_violin()函数,它相当于geom_violin()函数的变体,因为这个函数主要作用就是展示一半的小提琴图,然后与其他图形组合。 使用 geom_half_violin(mapping=NULL,data=NULL,stat="half_ydensity",position="dodge",...,side="l",nudge=0,draw_quantiles=NULL,trim=TRUE,scale="area"...
gene_split_violin <- ggplot(data_new,aes(x= gene,y= expression,fill= group))+ geom_split_violin(trim= F,color="white",scale = "area") + #绘制分半的小提琴图 geom_point(data = Data_summary,aes(x= gene, y= expression),pch=19, position=position_dodge(0.5),size= 1)+ #绘制均值为...
ggplot(data=data_bar,aes(x=types,y=disp,fill=types))+ geom_half_violin(alpha=0.5)+#绘制半个小提琴图 geom_boxplot(fill="white",color="black",position = position_nudge(x=-0.05), width=0.1,alpha=0.5)+#绘制箱线图 geom_jitter(width = 0.2,shape=21)+#width为横向抖动,不改变对应y值 sca...
geom_half_violin() 最近在一个介绍ggplot2扩展包的链接里发现了一个包叫see,这个包里有一个函数是geom_violindot()函数,画云雨图非常方便,下面简单介绍一下代码 首先是安装see这个R包 代码语言:javascript 复制 install.package("see") 使用鸢尾花的数据集作图 ...
geom_half_violin() 最近在一个介绍ggplot2扩展包的链接里发现了一个包叫see,这个包里有一个函数是geom_violindot()函数,画云雨图非常方便,下面简单介绍一下代码 首先是安装see这个R包 ...
gghalvesadds_half_extensions to selectedgeoms: geom_half_boxplot geom_half_violin geom_half_point All of them have asideargument that can be eitherlfor left orrfor right half. As a special case there is alsogeom_half_dotplotto support half dotplots that dodge aesthetics such asfillandcolour...
ggplot(data=df,aes(x=groups,y=value,fill=type))+geom_violin()+geom_boxplot() image.png 箱线图的宽度有点大,盖住了背后的小提琴图,把宽度设置的小一点,需要加width参数 代码语言:javascript 复制 ggplot(data=df,aes(x=groups,y=value,fill=type))+geom_violin()+geom_boxplot(width=0.3) ...
geom_flat_violin()+ theme(legend.position="none") 输出: 示例2:水平半小提琴情节 让我们看看使用 coord_flip() 函数水平对齐半小提琴图。 R实现 # Horizontal half violin plot ggplot(df,aes(cut,x,fill=cut))+ geom_flat_violin()+coord_flip()+ ...
qplot(x,y,data,geom=c(xx,xx)) 条形图 barplot()第一个向量用来设定条形的高度,第二个向量用来设定每个条形对应的标签(可选)。 变量值条形图: 两个输入变量,x为分类变量,y表示变量值 频数条形图:一个输入变量,需要注意连续x轴和离散x轴的差异。 直方图 与条形图不同的地方在于,x为连续型变量 箱线图 ...