File:R-US state areas-boxplot.svg
| Description |
English: Boxplot example (with notches) for continuous data, with outliers labelled by name. Data = US state areas |
||
| Date | |||
| Source | Own work | ||
| Author | HYanWong | ||
| Permission (Reusing this file) |
|
||
| SVG development | Category:Valid SVG created with R code#R-US%20state%20areas-boxplot.svg | ||
| Source code | R codesvg(file = "R-US_state_areas-boxplot.svg", width = 5, height = 1.5, pointsize = 8)
#Boxplot example (with notches) for continuous data, with outliers labelled by name. Data = US state areas
par(mar=c(4,1,3,1)+0.1)
X <- state.area*2.58998811/1000
bp <- boxplot(X, notch=TRUE, horizontal=TRUE,
xlab=expression(paste(italic("landArea")," (thousands of square km)")), xaxt="n")
axis(1,seq(0, 2e3, 100), cex.axis=0.8, las=2)
#label outliers
outliers <- order(match(X, sort(bp$out)), na.last=NA)
odd <- c(TRUE, FALSE)
text(X[outliers[!odd]], 1, labels=state.name[outliers[!odd]], adj=-0.2, cex=0.65, srt=45, xpd=NA, col="grey40")
text(X[outliers[odd]], 1, labels=state.name[outliers[odd]], adj=1.2, cex=0.65, srt=45, xpd=NA, col="grey40")
title("Size of US states")
dev.off()
|