# plot-market-shares.R # Ilari Scheinin # MIT License # This script reads operating system market share data from # http://ilari.scheinin.fidisk.fi/market-shares/market-shares.txt # and produces three plots from the data. market.shares <- read.table("http://ilari.scheinin.fidisk.fi/market-shares/market-shares.txt", header=TRUE, sep="\t") market.shares$Month <- as.Date(paste(market.shares$Month, "-01", sep="")) png("windows.png") plot(data.frame(market.shares$Month, 0), main="Windows", xlab="Month", ylab="Market Share", type="l", ylim=c(90, 100)) lines(market.shares[c("Month", "Windows")], col=1) dev.off() png("others.png") plot(data.frame(market.shares$Month, 0), main="Other Operating Systems", xlab="Month", ylab="Market Share", type="n", ylim=c(0, 6)) lines(market.shares[c("Month", "Mac")], col=2) lines(market.shares[c("Month", "Linux")], col=3) lines(market.shares[c("Month", "Other.device")], col=1) legend("topleft", inset=0.01, legend=c("Mac", "Linux", "Others"), fill=c(2:3, 1)) dev.off() png("handhelds.png") plot(data.frame(market.shares$Month, 0), main="Handheld Devices", xlab="Month", ylab="Market Share", type="n", ylim=c(0, 1)) lines(market.shares[c("Month", "iPhone.iPod")], col=2) lines(market.shares[c("Month", "Java")], col=3) lines(market.shares[c("Month", "Symbian")], col=4) lines(market.shares[c("Month", "Windows.Mobile")], col=5) lines(market.shares[c("Month", "Android")], col=6) lines(market.shares[c("Month", "BlackBerry")], col=7) lines(market.shares[c("Month", "Palm")], col=8) lines(market.shares[c("Month", "Other.handheld")], col=1) legend("topleft", inset=0.01, legend=c("iPhone/iPod", "Java", "Symbian", "Windows Mobile", "Android", "BlackBerry", "Palm", "Others"), fill=c(2:8, 1)) dev.off()