# this R code file is named: top15_teams_baseball_test_03.txt # cut and paste the code from text wrangler into R # baseball - game percentage # top 15 teams in 2011 (from highest to lowest) and 2012 baseball_top15 <- matrix(c(0.630,0.500,0.599,0.586,0.593,0.512,0.593,0.574,0.586,0.543,0.580,0.500,0.562,0.556,0.556,0.426,0.556,0.543,0.549,0.580,0.531,0.549,0.531,0.580,0.509,0.531,0.500,0.451,0.497,0.605),ncol=2,byrow=TRUE) rownames(baseball_top15) <- c("Philadelphia","NY Yankees","Milwaukee","Texas","Detroit","Arizona","Tampa Bay","Boston","St. Louis","Atlanta","LA Angels","San Francisco","LA Dodgers","Toronto","Washington") colnames(baseball_top15)<-c(2011,2012) # install and/or switch on the plotrix package, then run the bumpchart command below bumpchart(baseball_top15,main="Baseball game percentages - Top 15 teams in 2011") # now show the raw percentages and add ticks on left side (1.1) and right side (1.9) bumpchart(baseball_top15,rank=FALSE,main="Major league baseball - Game percentages - Top 15 teams 2011",col=rainbow(5)) # margins have been reset, so use par(xpd=TRUE) boxed.labels(1.1,seq(0.320,0.640,by=0.020),seq(0.320,0.640,by=0.020)) boxed.labels(1.9,seq(0.320,0.640,by=0.020),seq(0.320,0.640,by=0.020)) par(xpd=FALSE)