| Library: | graphic |
| See also: | grbar grdot grhist grdotd grash fivenum |
| Quantlet: | grbox | |
| Description: | Generates a boxplot with mean line and median line. Outliers outside the interval [Q_25-3*IQR, Q_75+3*IQR] will be plotted as crosses, outliers outside the interval [Q_25-1.5*IQR, Q_75+1.5*IQR] will be plotted as circles. |
| Usage: | bp = grbox (x {, col}) | |
| Input: | ||
| x | n x 1 vector, data | |
| col | scalar, number of color | |
| Output: | ||
| bp | composed graphical object | |
library("stats") ; loads the stats library
library("graphic") ; loads the graphic library
x=read("popul")[,1] ; reads data file and uses first column
b1d=grbox(x, 2) ; boxplot of the us cities in blue(col = 4) color
bd1=grrot(b1d,1) ; rotation of the plot
axes=graxes((-0.5|1.5)~(min(x)-0.05*(max(x)-min(x))|max(x)),"yticks",quantile(x,(0:2)/2),"origin",7.5,"xticks",0.5,"xtext","US cities","xtextpos",6,"ytextpos",9,"xtextsize",16,"ytextsize",16)
di=createdisplay(1,1) ; createdisplay "di"
axesoff()
show(di,1,1,bd1,axes) ; shows boxplot
shows a boxplot