Package beanplot. R topics documented: February 19, Type Package

Similar documents
Package sciplot. February 15, 2013

Package areaplot. October 18, 2017

Package qboxplot. November 12, qboxplot... 1 qboxplot.stats Index 5. Quantile-Based Boxplots

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0.

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R

Package feature. R topics documented: October 26, Version Date

Package feature. R topics documented: July 8, Version Date 2013/07/08

Package r2d2. February 20, 2015

Rstudio GGPLOT2. Preparations. The first plot: Hello world! W2018 RENR690 Zihaohan Sang

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

Package vipor. March 22, 2017

Package Daim. February 15, 2013

Package panelview. April 24, 2018

DSCI 325: Handout 18 Introduction to Graphics in R

Package mixphm. July 23, 2015

Package SPIn. R topics documented: February 19, Type Package

Package hextri. April 22, 2016

Package lvplot. August 29, 2016

Package desplot. R topics documented: April 3, 2018

Mixed models in R using the lme4 package Part 2: Lattice graphics

The nor1mix Package. August 3, 2006

Package glmnetutils. August 1, 2017

Package Mondrian. R topics documented: March 4, Type Package

Package R2SWF. R topics documented: February 15, Version 0.4. Title Convert R Graphics to Flash Animations. Date

The nor1mix Package. June 12, 2007

Package Grid2Polygons

Package statip. July 31, 2018

Package GLDreg. February 28, 2017

Package pathdiagram. R topics documented: August 29, 2016

INTRODUCTION TO R. Basic Graphics

Package fso. February 19, 2015

Package desire. R topics documented: February 19, Version Title Desirability functions in R

Outline. Part 2: Lattice graphics. The formula/data method of specifying graphics. Exploring and presenting data. Presenting data.

Package sure. September 19, 2017

Package glogis. R topics documented: March 16, Version Date

Package pca3d. February 17, 2017

Package JOP. February 19, 2015

Package logspline. February 3, 2016

Package RCEIM. April 3, 2017

Package sbf. R topics documented: February 20, Type Package Title Smooth Backfitting Version Date Author A. Arcagni, L.

The Basics of Plotting in R

Package kdevine. May 19, 2017

Package spd. R topics documented: August 29, Type Package Title Semi Parametric Distribution Version Date

Package sankey. R topics documented: October 22, 2017

Package RcmdrPlugin.HH

Package GCAI.bias. February 19, 2015

Package basictrendline

Package MFDFA. April 18, 2018

Plotting with Rcell (Version 1.2-5)

Package ICSOutlier. February 3, 2018

Package naivebayes. R topics documented: January 3, Type Package. Title High Performance Implementation of the Naive Bayes Algorithm

Package cgh. R topics documented: February 19, 2015

Package OptimaRegion

An Introduction to R 2.2 Statistical graphics

Package tclust. May 24, 2018

Package nprotreg. October 14, 2018

Package gridgraphics

Package JBTools. R topics documented: June 2, 2015

Package ModelGood. R topics documented: February 19, Title Validation of risk prediction models Version Author Thomas A.

Univariate Data - 2. Numeric Summaries

Package extremevalues

Package splines2. June 14, 2018

Package CINID. February 19, 2015

Package OutlierDC. R topics documented: February 19, 2015

Univariate Data - 2. Numeric Summaries

AN INTRODUCTION TO LATTICE GRAPHICS IN R

Data Visualization. Andrew Jaffe Instructor

Package replicatedpp2w

Package sspline. R topics documented: February 20, 2015

Package Kernelheaping

Package hbm. February 20, 2015

Package kdetrees. February 20, 2015

The RcmdrPlugin.HH Package

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package SFtools. June 28, 2017

Package nonmem2r. April 5, 2018

Package bdots. March 12, 2018

Package inca. February 13, 2018

Statistics 251: Statistical Methods

Package seg. February 15, 2013

Package abf2. March 4, 2015

Package rtsplot. September 15, 2018

Package Rwinsteps. February 19, 2015

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Graphics - Part III: Basic Graphics Continued

Package datasets.load

Package Combine. R topics documented: September 4, Type Package Title Game-Theoretic Probability Combination Version 1.

The BHH2 Package. July 27, 2006

Package docxtools. July 6, 2018

Package coefplot. R topics documented: February 15, Type Package. Title Plots Coefficients from Fitted Models. Version

Package arphit. March 28, 2019

Package ICSShiny. April 1, 2018

Package curvhdr. April 16, 2017

Package Kernelheaping

Package arulesviz. April 24, 2018

Package RTNduals. R topics documented: March 7, Type Package

Package qicharts. October 7, 2014

Basic Statistical Methods

Package ggsubplot. February 15, 2013

Package rdd. March 14, 2016

Transcription:

Type Package Package beanplot February 19, 2015 Title Visualization via Beanplots (like Boxplot/Stripchart/Violin Plot) Version 1.2 Date 2014-09-15 Author Peter Kampstra Maintainer Peter Kampstra <beanplot@kampstra.net> Description Plots univariate comparison graphs, an alternative to boxplot/stripchart/violin plot. Suggests vioplot, lattice License GPL-2 NeedsCompilation no Repository CRAN Date/Publication 2014-09-19 11:40:15 R topics documented: beanplot-package...................................... 1 beanplot........................................... 2 Index 8 beanplot-package Visualization via Beanplots (like Boxplot/Stripchart/Violin Plot Description Details Plots univariate comparison graphs, alternative to boxplot/stripchart/violin plot 1

2 beanplot Package: beanplot Type: Package Version: 1.2 Date: 2014-09-15 License: GPL-2 The function beanplot does all the work. Author(s) Peter Kampstra <beanplot@kampstra.net> References Kampstra, P. (2008) Beanplot: A Boxplot Alternative for Visual Comparison of Distributions. Journal of Statistical Software, Code Snippets, 28(1), 1-9. URL http://www.jstatsoft.org/v28/ c01/ See Also graphics vioplot Examples beanplot(rnorm(100), runif(100)) vignette("beanplot", package = "beanplot") beanplot Beanplot: A Boxplot/Stripchart/Vioplot Alternative Description Usage Plots beans to compare the distributions of different groups; it draws one bean per group of data. A bean consists of a one-dimensional scatter plot, its distribution as a density shape and an average line for the distribution. Next to that, an overall average for the whole plot is drawn per default. beanplot(..., bw = "SJ-dpi", kernel = "gaussian", cut = 3, cutmin = -Inf, cutmax = Inf, grownage = 10, what = c(true, TRUE, TRUE, TRUE), add = FALSE, col, axes = TRUE, log = "auto", handlelog = NA, ll = 0.16, wd = NA, maxwidth = 0.8, maxstripline = 0.96, method = "stack", names, overallline = "mean", beanlines = overallline, horizontal = FALSE, side = "no", jitter = NULL, beanlinewd = 2, frame.plot = axes, border = NULL, innerborder = NA, at = NULL, boxwex = 1, ylim = NULL, xlim = NULL, show.names = NA)

beanplot 3 Arguments... data which to perform the beanplot on. This data can consist of dataframes, vectors and/or formulas. For each formula, a dataset can be specified with data=[dataset], and a subset can be specified with subset=[subset]. If subset/data arguments are passed, but there are not enough subset/data arguments, they are reused. Additionally, na.action, drop.unused.levels and xlev can be passed to model.frame in the same way. Also, parameters for axis and title can be passed. bw kernel cut cutmin cutmax grownage what add col axes the bandwidth (method) being used, used by density. In case of a method, the average computed bandwidth is used. see density. the beans are cut beyond cut*bw the low-ends of the beans are cut below mincut*bw. Defaults to cut. the high-ends of the beans are cut beyond maxcut*bw. Defaults to cut. the width of a bean grows linearly with the count of points, until grownage is reached. a vector of four booleans describing what to plot. In the following order, these booleans stand for the total average line, the beans, the bean average, and the beanlines. For example, what=c(0,0,0,1) produces a stripchart if true, do not start a new plot the colors to be used. A vector of up to four colors can be used. In the following order, these colors stand for the area of the beans (without the border, use border for that color), the lines inside the bean, the lines outside the bean, and the average line per bean. Transparent colors are supported. col can be a list of color vectors, the vectors are then used per bean, and reused if necessary. if false, no axes are drawn. log use log="y" or log="" to force a log-axis. In case of log="auto", a logtransformation is used if appropriate handlelog ll wd maxwidth maxstripline method names overallline beanlines if handlelog then all the calculations are done using a log-scale. By default this is determined using the log parameter. the length of the beanline per point found. the linear transformation that determines the width of the beans. By default determined using maxwidth, and returned. the maximum width of a bean. the maximum length of a beanline. the method used when two points on a bean are the same. "stack", "overplot" and "jitter" are supported. a vector of names for the groups. the method used for determining the overall line. Defaults to "mean", "median" is also supported. the method used for determining the average bean line(s). Defaults to "mean", "median" and "quantiles" are also supported.

4 beanplot horizontal side jitter beanlinewd frame.plot border innerborder at boxwex ylim xlim show.names if true, the beanplot is horizontal the side on which the beans are plot. Default is "no", for symmetric beans. "first", "second" and "both" are also supported. passed to jitter as amount in case of method="jitter". the width used for the average bean line if true, plots a frame. the color for the border around a bean. NULL for par("fg"), NA for no border. If border is a vector, it specifies the color per bean, and colors are reused if necessary. a color (vector) for the border inside the bean(s). Especially useful if side="both". Use NA for no inner border. Colors are reused if necessary. The inner border is drawn as the last step in the drawing process. the positions at which a bean should be drawn. a scale factor applied to all beans. Compatible with boxplot. the range to plot. the range to plot the beans at. if true, plots the names as axis labels Details Use the "what" parameter to omit certain parts from drawing. Most parameters are compatible with boxplot and stripchart. For compatibility, arguments with the name "formula" or "x" are used as data. However, data or formulas do not need to be named "x" or "formula". The function handles (combinations of) dataframes, vectors and/or formulas. Value bw wd names stats overall log the bandwidth (bw) used. the bean width (wd) used. a vector of names for the groups. a vector of statistics calculated for the beanlines. statistic calculated for the overall line. log axis that was selected. Note In case of more than 5000 values per bean, the autodetection of the log parameter is approximated. In such cases, use log="" or log="y". Also, the what parameter can help to omit parts that are not useful in certain plots, and take time to draw. Author(s) Peter Kampstra <beanplot@kampstra.net>

beanplot 5 References Kampstra, P. (2008) Beanplot: A Boxplot Alternative for Visual Comparison of Distributions. Journal of Statistical Software, Code Snippets, 28(1), 1-9. URL http://www.jstatsoft.org/v28/ c01/ See Also boxplot, stripchart, density, rug, vioplot in package vioplot Examples beanplot(rnorm(22),rnorm(22),rnorm(22),main="test!",rnorm(3)) #mostly examples taken from boxplot: par(mfrow = c(1,2)) boxplot(count ~ spray, data = InsectSprays, col = "lightgray") beanplot(count ~ spray, data = InsectSprays, col = "lightgray", border = "grey", cutmin = 0) boxplot(count ~ spray, data = InsectSprays, col = "lightgray") beanplot(count ~ spray, data = InsectSprays, col = "lightgray", border = "grey", overallline = "median") boxplot(decrease ~ treatment, data = OrchardSprays, log = "y", col = "bisque", ylim = c(1,200)) beanplot(decrease ~ treatment, data = OrchardSprays, col = "bisque", ylim = c(1,200)) par(mfrow = c(2,1)) mat <- cbind(uni05 = (1:100)/21, Norm = rnorm(100), T5 = rt(100, df = 5), Gam2 = rgamma(100, shape = 2)) par(las=1)# all axis labels horizontal boxplot(data.frame(mat), main = "boxplot(*, horizontal = TRUE)", horizontal = TRUE, ylim = c(-5,8)) beanplot(data.frame(mat), main = "beanplot(*, horizontal = TRUE)", horizontal = TRUE, ylim = c(-5,8)) par(mfrow = c(1,2)) boxplot(len ~ dose, data = ToothGrowth, boxwex = 0.25, at = 1:3-0.2, subset = supp == "VC", col = "yellow", main = "Guinea Pigs Tooth Growth", xlab = "Vitamin C dose mg", ylab = "tooth length", ylim = c(-1, 40), yaxs = "i") boxplot(len ~ dose, data = ToothGrowth, add = TRUE, boxwex = 0.25, at = 1:3 + 0.2, subset = supp == "OJ", col = "orange") legend("bottomright", bty="n", c("ascorbic acid", "Orange juice"), fill = c("yellow", "orange")) allplot <- beanplot(len ~ dose+supp, data = ToothGrowth, what=c(true,false,false,false),show.names=false,ylim=c(-1,40), yaxs = "i") beanplot(len ~ dose, data = ToothGrowth, add=true, boxwex = 0.6, at = 1:3*2-0.9,

6 beanplot subset = supp == "VC", col = "yellow",border="yellow2", main = "Guinea Pigs Tooth Growth", xlab = "Vitamin C dose mg", ylab = "tooth length", ylim = c(3, 40), yaxs = "i", bw = allplot$bw, wd = allplot$wd, what = c(false,true,true,true)) beanplot(len ~ dose, data = ToothGrowth, add = TRUE, boxwex = 0.6, at = 1:3*2-0.1, subset = supp == "OJ", col = "orange",border="darkorange", bw = allplot$bw, wd = allplot$wd, what = c(false,true,true,true)) legend("bottomright", bty="n", c("ascorbic acid", "Orange juice"), fill = c("yellow", "orange")) par(mfrow = c(1,2)) boxplot(len ~ dose, data = ToothGrowth, boxwex = 0.25, at = 1:3-0.2, subset = supp == "VC", col = "yellow", main = "Guinea Pigs Tooth Growth", xlab = "Vitamin C dose mg", ylab = "tooth length", ylim = c(-1, 40), yaxs = "i") boxplot(len ~ dose, data = ToothGrowth, add = TRUE, boxwex = 0.25, at = 1:3 + 0.2, subset = supp == "OJ", col = "orange") legend("bottomright", bty="n",c("ascorbic acid", "Orange juice"), fill = c("yellow", "orange")) beanplot(len ~ reorder(supp, len, mean) * dose, ToothGrowth, side = "b", col = list("yellow", "orange"), border = c("yellow2", "darkorange"), main = "Guinea Pigs Tooth Growth", xlab = "Vitamin C dose mg", ylab = "tooth length", ylim = c(-1, 40), yaxs = "i") legend("bottomright", bty="n",c("ascorbic acid", "Orange juice"), fill = c("yellow", "orange")) #Example with multiple vectors and/or formulas par(mfrow = c(2,1)) beanplot(list(all = ToothGrowth$len), len ~ supp, ToothGrowth, len ~ dose) title("tooth growth length (beanplot)") #Trick using internal functions to do this with other functions: mboxplot <- function(...){ graphics::boxplot(beanplot:::getgroupsfromarguments(),...) } mstripchart <- function(..., method = "overplot", jitter = 0.1, offset = 1/3, vertical = TRUE, group.names, add = FALSE, at = NULL, xlim = NULL, ylim = NULL, ylab = NULL, xlab=null, dlab = "", glab = "", log = "", pch = 0, col = par("fg"), cex = par("cex"), axes = TRUE, frame.plot = axes) { graphics::stripchart(beanplot:::getgroupsfromarguments(), method, jitter, offset, vertical, group.names, add, at, xlim, ylim, ylab, xlab, dlab, glab, log, pch, col, cex, axes, frame.plot) } mstripchart(list(all = ToothGrowth$len), len ~ supp, ToothGrowth, len ~ dose, xlim = c(0.5,6.5))

beanplot 7 title("tooth growth length (stripchart)")

Index Topic hplot beanplot, 2 Topic package beanplot-package, 1 axis, 3 beanplot, 2, 2 beanplot-package, 1 boxplot, 4, 5 density, 3, 5 graphics, 2 jitter, 4 model.frame, 3 rug, 5 stripchart, 3 5 title, 3 vioplot, 2, 5 8