Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- types <- c("Conqueror","Manager","Wanderer","Participant")
- mycolors <- c(rgb(0.1,0.1,0.1), rgb(0.5,0.5,0.5), rgb(0.8,0.8,0.8))
- survey <- c(15.5,27.5,45,12)
- bartle <- c(31,27,25.5,15.5)
- control <- c(24,16.5,29.5,30)
- data <- rbind(survey,bartle,control)
- #adjust margins
- par(mar=c(2.5,4.5,1,1))
- # http://stat.ethz.ch/R-manual/R-patched/library/graphics/html/barplot.html
- barplot(data, beside=TRUE,
- ylab="Percent of respondents",
- names.arg=types, ylim=c(0,50), col=mycolors)
- # grid only in y-direction
- # http://stat.ethz.ch/R-manual/R-patched/library/graphics/html/grid.html
- grid(NA, 10)
- # legend at the top-left corner
- legend("topleft", c("Survey","Bartle","Control"), cex=1.3, bty="n", fill=mycolors);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement