# This will make a plot with boxes for interquartile (box), median (line) and outliers (whiskers)
superbPlot(ToothGrowth,
BSFactors = c("dose","supp"), variables = "len",
plotStyle = "boxplot"
)
# This layout of course is more meaningful if the statistic displayed is the median
superbPlot(ToothGrowth,
BSFactors = c("dose","supp"),
variables = "len",
statistic = "median",
plotStyle = "boxplot"
)
# if you extracted the data with superbData, you can
# run this layout directly
processedData <- superbData(ToothGrowth,
BSFactors = c("dose","supp"), variables = "len", statistic = "median"
)
superbPlot.boxplot(processedData$summaryStatistic,
"dose", "supp", ".~.",
processedData$rawData)
# This will make a plot with customized boxplot parameters and black dots
superbPlot(ToothGrowth,
BSFactors = c("dose","supp"), variables = "len",
statistic = "median",
plotStyle = "boxplot",
boxplotParams = list( outlier.shape=8, outlier.size=4 ),
pointParams = list(color="black")
)
# You can customize the plot in various ways, e.g.
plt3 <- superbPlot(ToothGrowth,
BSFactors = c("dose","supp"), variables = "len",
statistic = "median",
plotStyle = "boxplot",
pointParams = list(color="black")
)
# ... by changing the colors of the fillings
library(ggplot2) # for scale_fill_manual, geom_jitter and geom_dotplot
plt3 + scale_fill_manual(values=c("#999999", "#E69F00", "#56B4E9"))
# ... by overlaying jittered dots of the raw data
plt3 + geom_jitter(data = processedData$rawData, mapping=aes(x=dose, y=DV),
position= position_jitterdodge(jitter.width=0.5 , dodge.width=0.8 ) )
# ... by overlaying dots of the raw data, aligned along the center of the box
plt3 + geom_dotplot(data = processedData$rawData, mapping=aes(x=dose, y=DV), dotsize=0.5,
binaxis='y', stackdir='center', position=position_dodge(0.8))
Run the code above in your browser using DataLab