library(onewaytests)
# box-and-whisker with dots
gplot(Sepal.Length~Species, data = iris, type = "boxplot")
# box-and-whisker without dots
gplot(Sepal.Length~Species, data = iris, type = "boxplot", dots = FALSE)
# to change the width of the boxes for box-and-whisker plots
gplot(Sepal.Length~Species, data = iris, type = "boxplot", width = c(0.4, NA, NA))
# violin plot with dots
gplot(Sepal.Length~Species, data = iris, type = "violin")
# to change the width of violin plots
gplot(Sepal.Length~Species, data = iris, type = "violin", width = c(NA, 0.8, NA))
# box-and-whisker plot with violin lines and dots
gplot(Sepal.Length~Species, data = iris, type = "boxplot-violin")
# to change the width of the boxes for box-and-whisker plots and the width of violin plots
gplot(Sepal.Length~Species, data = iris, type = "boxplot-violin", width = c(0.25, 0.95, NA))
# to change the theme
library(ggplot2)
gplot(Sepal.Length~Species, data = iris, type = "boxplot-violin", width = c(0.25, 0.95, NA),
theme = theme_minimal())
# to specify the colors
gplot(Sepal.Length~Species, data = iris, type = "boxplot-violin", width = c(0.25, 0.95, NA),
color_manual=c("#999999","#E69F00","#56B4E9"))
# to specify the colors as white
gplot(Sepal.Length~Species, data = iris, type = "boxplot-violin", width = c(0.25, 0.95, NA),
color_manual=c("white","white","white"))
#to change color palette
library(wesanderson)
gplot(Sepal.Length~Species, data = iris, type = "boxplot-violin", width = c(0.25, 0.95, NA),
color_manual=wes_palette(name="GrandBudapest1",n=3))
# error bars (mean +- standard deviation) without bars
gplot(Sepal.Length~Species, data = iris, type = "errorbar", option = "sd", bar = FALSE)
# error bars (mean +- standard deviation) with bars
gplot(Sepal.Length~Species, data = iris, type = "errorbar", option = "sd", bar = TRUE)
# to change the width of the little lines at the tops and bottoms of the error bars
gplot(Sepal.Length~Species, data = iris, type = "errorbar", width = c(NA, NA, 0.25))
# error bars (mean +- standard error) without bars
gplot(Sepal.Length~Species, data = iris, type = "errorbar", option = "se", bar = FALSE)
Run the code above in your browser using DataLab