File:R-horsekick totals-quantileplot+quartiles.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
![File:R-horsekick totals-quantileplot+quartiles.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/R-horsekick_totals-quantileplot%2Bquartiles.svg/360px-R-horsekick_totals-quantileplot%2Bquartiles.svg.png?20090306225256)
Size of this PNG preview of this SVG file: 360 × 360 pixels. Other resolutions: 240 × 240 pixels | 480 × 480 pixels | 768 × 768 pixels | 1,024 × 1,024 pixels | 2,048 × 2,048 pixels.
Original file (SVG file, nominally 360 × 360 pixels, file size: 99 KB)
File information
Structured data
Captions
Captions
Add a one-line explanation of what this file represents
DescriptionR-horsekick totals-quantileplot+quartiles.svg |
English: Basic quantile plot example, with quartiles marked in colour shading and corresponding boxplot. Data = von Bortkiewicz's famous dataset of deaths by horse kick in Prussian cavalry corps |
|||
Date | ||||
Source | Own work | |||
Author | HYanWong | |||
Permission (Reusing this file) |
|
using the following commands
svg(file = "R-horsekick_totals-quantileplot+quartiles.svg", width = 4, height = 4, pointsize = 8) #Basic quantile plot example, with quartiles marked in colour shading and corresponding boxplot. Data = von Bortkiewicz's famous dataset of deaths by horse kick in Prussian cavalry corps library("pscl") par(mar=c(4,4,5,3)+0.1) draw.quantile <- function(data, x, x2=NULL, ..., border = NA) { ##draw a line down then across. If x2 exists, fill between the quantiles y <- quantile(data,x, type=5) ymax <- max(data)+diff(range(data))*0.1 xmax <- 1.1 if(is.null(x2)) { segments(x, ymax, x, y, ...) segments(x,y,xmax,y, ...) } else { y2 <- quantile(data, x2, type=5) mapply( function(X1,X2,Y1,Y2, border, ...) polygon(c(X1,X1,xmax,xmax,X2,X2), c(ymax,Y1,Y1, Y2, Y2, ymax), border=border, ...), x, x2, y, y2, border, ...) } } X <- tapply(prussian$y, prussian$year, sum) plot(NA, ylim=c(0,20), xlim=0:1, xaxt="n", xlab="Year", ylab=expression(italic("deathsPerYear"))) draw.quantile(X, 0, 0.25, col="#00FF0044") draw.quantile(X, 0.75, 1, col="#FF000044") draw.quantile(X, 0:4/4, lty=c(3,3,2,3,3)) points(seq(0,1, length=length(X)), sort(X), type="b") axis(3, 0:4/4, paste(0:4/4*100, "%", sep=""), tcl=-0.2, mgp=c(0.5,0.5,0)) axis(1, seq(0,1,length=length(X)), paste("'", names(sort(X)), sep=""), las=3) par(no.readonly=T) -> par par(xpd=NA) boxplot(X, add=TRUE, at=1.1, boxwex=0.1) par(par) title("Deaths by horsekick in\nPrussian cavalry corps, 1875-94", line=2) dev.off()
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 22:52, 6 March 2009 | ![]() | 360 × 360 (99 KB) | HYanWong (talk | contribs) | {{Information |Description={{en|1=Basic quantile plot example, with quartiles marked in colour shading and corresponding boxplot. Data {{=}} von Bortkiewicz's famous dataset of deaths by horse kick in Prussian cavalry corps}} |Source=Own work by uploader |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikibooks.org