if(!require(devtools)){
install.packages(devtools)
}
devtools::install_github("haoeric/StackedDensityPlot", dependencies = TRUE)
## iris data
head(iris)
summary(iris)
## wine data
data(wine, package='rattle')
head(wine)
summary(wine)
library(StackedDensityPlot)
stackedDenistyPlot(iris, densityColNames = colnames(iris)[1:4], stackFactor = iris$Species)
stackedDenistyPlot(wine, densityColNames = colnames(wine)[2:13], stackFactor = wine$Type)
## fully overlap
stackedDenistyPlot(wine, densityColNames = colnames(wine)[c(2,4,5,7)], stackFactor = wine$Type, stackSeperation = 0)
## 30% overlap
stackedDenistyPlot(wine, densityColNames = colnames(wine)[c(2,4,5,7)], stackFactor = wine$Type, stackSeperation = 0.3)
stackedDenistyPlot(wine, densityColNames = colnames(wine)[c(2,4,5,7)], stackFactor = wine$Type, stackRotation = 8)
my_colors <- c("green", "Blue", "Red")
stackedDenistyPlot(wine, densityColNames = colnames(wine)[c(2,4,5,7)], stackFactor = wine$Type, stackRotation = 0, stackColor = my_colors)
Like change the Size of legends, stripe labels, legend keys, x label text, etc.
my_colors <- c("green", "Blue", "Red")
stackedDenistyPlot(wine, densityColNames = colnames(wine)[c(2,4,5,7)], stackFactor = wine$Type, stackRotation = 0, stackColor = my_colors, x_text_size = 2, strip_text_size = 10, legend_text_size = 0.8, legendRow = 1, legend_title = "Wine Type", legend_title_size = 1, legend_key_size = 0.15)