bplot | R Documentation |
Plots boxplots of several groups of data and allows for placement at different horizontal or vertical positions. It is also flexible in the input object accepting either a list or matrix.
bplot(x, by, style = "tukey", outlier = TRUE, plot = TRUE, ...)
x |
Vector, matrix, list or data frame. A vector may be divided according to the by argument. Matrices and data frames are separated by columns and lists by components. |
by |
If x is a vector, an optional vector (either character or numerical) specifying the categories to divide x into separate data sets. |
style |
Type of boxplot default is "tukey". The other choice is "quantile" where the whiskers are drawn to the 5 and 95 percentiles instead being based on the inner fences. |
outlier |
If true outliers (points beyond outer fences) will be added to the plots. |
plot |
If false just returns a list with the statistics used for plotting the box plots. |
... |
Other arguments controlling the boxplots (passed to bplot.obj) these are listed below. Other graphical plotting arguments not matched (e.g. yaxt) are used in the call to plot to set up the initial plot if add=TRUE.
|
This function was created as a complement to the usual S function for boxplots. The current function makes it possible to put the boxplots at unequal x or y positions. This is useful for visually grouping a large set of boxplots into several groups. Also placement of the boxplots with respect to the axis can add information to the plot. Another aspect is the emphasis on data structures for groups of data. One useful feature is the by option to break up the x vector into distinct groups. If 5 or less observations are in a group the points themselves are plotted instead of a box.
The function is broken into two steps: a call to stats.bplot to find the statistics and a call to bplot.obj to plot the resulting object. The user is referred to describe.bplot to modify the statistics used and to draw.bplot.obj to modify how the bplot is drawn.
Finally to bin data into groups based on a continuous variable and to make bplots of each group see bplot.xy.
boxplot, bplot.xy, lplot, mplot, plot
# set.seed(123) temp<- matrix( rnorm(12*8), ncol=12) pos<- c(1:6,9:14) bplot(temp) # bplot( temp, pos=pos, labels=paste( "D",1:12), horizontal=TRUE) # bplot( temp, pos=pos, label.cex=0, horizontal=TRUE) # add an axis axis( 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.