Advertisement
Guest User

bar plot of DGD1, Bartle and control population percentages

a guest
Oct 31st, 2011
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.71 KB | None | 0 0
  1. types <- c("Conqueror","Manager","Wanderer","Participant")
  2. mycolors <- c(rgb(0.1,0.1,0.1), rgb(0.5,0.5,0.5), rgb(0.8,0.8,0.8))
  3. survey <- c(15.5,27.5,45,12)
  4. bartle <- c(31,27,25.5,15.5)
  5. control <- c(24,16.5,29.5,30)
  6. data <- rbind(survey,bartle,control)
  7.  
  8. #adjust margins
  9. par(mar=c(2.5,4.5,1,1))
  10.  
  11. # http://stat.ethz.ch/R-manual/R-patched/library/graphics/html/barplot.html
  12. barplot(data, beside=TRUE,
  13.     ylab="Percent of respondents",
  14.     names.arg=types, ylim=c(0,50), col=mycolors)
  15.  
  16. # grid only in y-direction
  17. # http://stat.ethz.ch/R-manual/R-patched/library/graphics/html/grid.html
  18. grid(NA, 10)
  19.  
  20. # legend at the top-left corner
  21. legend("topleft", c("Survey","Bartle","Control"), cex=1.3, bty="n", fill=mycolors);
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement