- 介紹
ggplot2.multiplot是一個易于使用的功能,將多個圖形在同一頁面上使用R統計軟件和GGPLOT2繪圖方法。這個功能是從easyGgplot2包。安裝并加載easyGgplot2包
easyGgplot2 ?軟件包可以安裝如下:
install.packages("devtools")
library(devtools)
install_github("easyGgplot2", "kassambara")
使用裝載該R代碼軟件包:
library(easyGgplot2)
例子:
# data.frame
df <- ToothGrowth
# 自定義框圖與中心點圖
plot1<-ggplot2.boxplot(data=df, xName='dose',yName='len', groupName='dose', addDot=TRUE, dotSize=1, showLegend=FALSE) + theme_bw()
# 帶中心點圖的自定義點圖
plot2<-ggplot2.dotplot(data=df, xName='dose',yName='len', groupName='dose',showLegend=FALSE) + theme_bw()
# 帶有中心點圖的自定義帶狀圖
plot3<-ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', showLegend=FALSE) + theme_bw()
# Notched box plot
plot4<-ggplot2.boxplot(data=df, xName='dose',yName='len', notch=TRUE) + theme_bw()
#在同一頁上的多個圖表
ggplot2.multiplot(plot1,plot2,plot3,plot4, cols=2)
- ggplot2.multiplot功能
描述
把多個圖形在同一頁面上
用法
library(easyGgplot2)
ggplot2.multiplot(..., plotlist=NULL, cols=2)