Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2016
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.77 KB | None | 0 0
  1. load("allRes.rda")
  2.  
  3. dat <- data.frame(
  4.   rbind(
  5.     cbind("Kadencja VII",substr(unlist(allRes7), 1, 2))
  6.     ,
  7.     cbind("Kadencja VIII",substr(unlist(allRes8), 1, 2))
  8.   )
  9. )
  10. names(dat) <- c("kadencja","godzina")
  11.  
  12. dat$godzina <- as.numeric(levels(dat$godzina))[dat$godzina]
  13.  
  14. if(!require(ggplot2)){
  15.   install.packages("ggplot2")
  16. }
  17. library(ggplot2)
  18.  
  19. # Interleaved histograms
  20. ggplot(dat, aes(x=godzina, fill=kadencja)) +
  21.   geom_histogram(binwidth=.5, position="dodge")
  22.  
  23. # Density plots with semi-transparent fill
  24. ggplot(dat, aes(x=godzina, fill=kadencja)) + geom_density(alpha=.3)
  25.  
  26. # With flipped axes
  27. ggplot(dat, aes(x=kadencja, y=godzina, fill=kadencja)) + geom_boxplot() +
  28.   guides(fill=FALSE) + coord_flip() + stat_summary(fun.y=mean, geom="point", shape=5, size=4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement