Advertisement
weredwarf

Manual plot code

Sep 3rd, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. data <- read.csv(file = "population.csv", header = TRUE, sep = ,) ##import data file
  2. a <- split(data,list(state)) ##split factor state into individual states
  3. x <- c("Census", 2010, 2011, 2012, 2013, 2014) ##set x axis tick mark labels to placeholder variable
  4. y <- axTicks(2)
  5. plot(a$Alabama$Population, type = "o", xlab = "Year", ylab = "Population (millions)", xaxt="n", yaxt="n")
  6. title(main = "Population Growth - Alabama: 2010 - 2014") ##add main title
  7. axis(1, at = 1:6, labels = x) ##place x axis tick marks
  8. axis(2, las = 1, at = seq(min(y),max(y),(max(y)-min(y))/2), labels = c(round(min(y),2),round((max(y)+min(y))/2,2),round(max(y),2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement