当一个ggside_layer被添加到一个 ggplot 中时,该图表被转换为一个ggside对象,它具有不同的ggplot_buildS3 方法。这个方法允许侧边几何对象在一个单独的面板上绘制。 GeomBar GeomBoxplot GeomDensity GeomFreqpoly GeomHistogram GeomLine GeomPath GeomPoint GeomText GeomTile GeomViolin Facets分面 从技术上讲,gg...
library(ggside) ## 载入需要的程辑包:ggplot2 ## Registered S3 method overwritten by 'ggside': ## method from ## +.gg ggplot2 p <- ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point(size = 2) + theme_bw() p plot of chunk unnamed-chunk-2 现在我们想在散点图的上方添...
library(ggside)## 载入需要的程辑包:ggplot2 ## RegisteredS3method overwritten by'ggside':## method from ##+.gg ggplot2 p<-ggplot(mpg,aes(displ,hwy,colour=class))+geom_point(size=2)+theme_bw()p plot of chunk unnamed-chunk-2 现在我们想在散点图的上方添加一个箱线图,用以显示不同class...
library(ggside) ## 载入需要的程辑包:ggplot2 ## Registered S3 method overwritten by 'ggside': ## method from ## +.gg ggplot2 p <- ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point(size =2) + theme_bw() p plot of chunk unnamed-chunk-2 现在我们想在散点图的上方添加...
library(ggplot2) library(gridExtra) plot1 <- ggplot(InsectSprays, aes(x = spray, y = count)) + geom_boxplot(fill = "pink") plot2 <- ggplot(mtcars, aes(x = mpg)) + geom_histogram(fill = "yellow", bins = 30) plot3 <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point...
ggside有点类似于ggExtra,是用来添加边际图形的,但是比ggExtra更加灵活。可以添加非常多的类型,在语法上也更加靠近ggplot2的写法。 aplot有时候可以做到,但是专门的事还是要给专门的包做! “ 包治百病! 安装 #CRAN install.packages("ggside") #Github
(InsectSprays,aes(x=spray,y=count))+geom_boxplot(fill="pink")plot2<-ggplot(mtcars,aes(x=mpg))+geom_histogram(fill="yellow",bins=30)plot3<-ggplot(mtcars,aes(x=wt,y=mpg))+geom_point(fill="orange")grid.arrange(plot1,plot2,plot3,widths=c(2,2,1),layout_matrix=rbind(c(1,2,2)...
geom_ysidehistogram( mapping = NULL, data = NULL, stat = "bin", position = "stack", ..., binwidth = NULL, bins = NULL, na.rm = FALSE, orientation = "y", show.legend = NA, inherit.aes = TRUE ) 2)示例 p <-ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species, fil...
library(ggplot2)library(gridExtra)plot1<-ggplot(InsectSprays,aes(x=spray,y=count))+geom_boxplot(fill="pink")plot2<-ggplot(mtcars,aes(x=mpg))+geom_histogram(fill="yellow",bins=30)plot3<-ggplot(mtcars,aes(x=wt,y=mpg))+geom_point(fill="orange")grid.arrange(plot1,plot2,plot3,widths=...
library(ggplot2) library(gridExtra) plot1 <- ggplot(InsectSprays, aes(x = spray, y = count)) + geom_boxplot(fill = "pink") plot2 <- ggplot(mtcars, aes(x = mpg)) + geom_histogram(fill = "yellow", bins = 30) plot3 <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point...