ggplot2 110129

Download ggplot2 110129

If you can't read please download the document

Upload: takashi-minoda

Post on 23-Jun-2015

2.642 views

Category:

Technology


2 download

DESCRIPTION

Tokyo.R 用 資料ggplot2

TRANSCRIPT

  • 1. ggplot2 Wickam

2.

3. 4. 5. ggplot2 6. 7. 8. 9. 10. 11.

12. Twitter aad34210 13. http://pracmper.blogspot.com/ 14. 15. 16. Web 17. 18.

        • MGSPW

19. 20.

  • 1125

21. 2

  • ggplot2 Hadley Wickham

22. Uwe Ligges URL

  • http://jasp.ism.ac.jp/~nakanoj/workshop10/2010Rmeeting.htm

23.

  • Wickham()ggplot2WorkShop

24. LiggesCRAN 25. 26.

  • 3040

27. 28. 29. 30.

  • plot

31. 32. ggplot2 33. ggplot2

  • ggplot2
  • ggplot2 is a plotting system for R, based on the grammar of graphics,which tries to take the good parts of base and lattice graphics and none of the bad parts. It takes care of many of the fiddly details that make plotting a hassle (like drawing legends) as well asproviding a powerful model of graphics that makes it easy to produce complex multi-layered graphics

34. R http://had.co.nz/ggplot2/ 35. ggplot2

36. 37.

  • install.packages(ggplot2)

38. library(ggplot2) CRAN Japan(Hyogo) Japan(Tsukuba) MacOS 39. 40.

  • ggplot22
  • ggplot([data] , aes(x = X , y = Y )) :
  • + geom_() :

41. + geom_() : 2 42. + xlim( , ) + ylim( , ) 43. + xlab(X )+ ylab(Y )

    • ggplot(movies, aes(x=mpaa, y=rating))+geom_jitter(aes(colour=rating))+xlab() + ylab()

44.

  • ggplot22
  • qplot(x , y , data = [data] , geom = )
    • qplot(mpaa, rating, data=movies,geom=c("boxplot","jitter"))

ggplot~,qplot 45. 46.

  • diamonds (ggplot

47. data(diamonds) 48. 49. caratcut color clarity depth table pricexyz 50. 10.23IdealESI261.555326 3.95 3.98 2.43 51. 20.21PremiumESI159.861326 3.89 3.84 2.31 52. 30.23GoodEVS156.965327 4.05 4.07 2.31 53. 40.29PremiumIVS262.458334 4.20 4.23 2.63 54. 50.31GoodJSI263.358335 4.34 4.35 2.75 55. 60.24 Very GoodJVVS262.857336 3.94 3.96 2.48 56. cut , carat X qplot(cut, data = diamonds) ggplot(diamonds , aes(cut)) + geom_bar() qplot(carat, data = diamonds) ggplot(diamonds , aes(carat)) + geom_bar() qplot(carat, data = diamonds, binwidth = 1) ggplot(diamonds , aes(x = carat)) + geom_bar(binwidth = 1) qplot(carat, data = diamonds, binwidth = 0.1) ggplot(diamonds , aes(x = carat)) + geom_bar(binwidth = 0.1) qplot(carat, data = diamonds, binwidth = 0.01) ggplot(diamonds , aes(x = carat)) + geom_bar(binwidth = 0.1) 57. depth Cut qplot(depth, data = diamonds, binwidth = 0.2, fill = cut) + xlim(55, 70) ggplot(diamonds , aes(depth , fill = cut)) + geom_bar(binwidth = 0.2) + xlim (55 , 70) depth Cut qplot(depth, data = diamonds, binwidth = 0.2) + xlim(55, 70) + facet_wrap(~ cut) ggplot(diamonds , aes(depth)) + geom_bar(binwidth = 0.2) + xlim(55 , 70) + facet_wrap(~cut) (hexbin) qplot(log10(carat), log10(price), data = diamonds,geom = "hex", bins = 10) + facet_wrap(~ cut) 58. price carat qplot(price, carat, data = diamonds, colour = I("blue")) ggplot(diamonds , aes(x = price , y = carat)) + geom_jitter(colour = I("blue") ) - ggplot(diamonds , aes(price , carat)) + geom_jitter(colour = I("blue") )+ geom_smooth(colour = "red")- ggplot(diamonds , aes(price , carat)) + geom_jitter() + geom_smooth(method = "lm") http://had.co.nz/ggplot2/geom_smooth.html 59. price carat qplot(price, carat, data = diamonds, alpha = I(1/10)) qplot(price, carat, data = diamonds, alpha = I(1/50)) qplot(price, carat, data = diamonds, alpha = I(1/100)) qplot(price, carat, data = diamonds, alpha = I(1/250)) 60. Boxplot movie ggplot(movies , aes(x = mpaa , y = rating)) + geom_jitter() ggplot(movies , aes(x = mpaa , y = rating)) + geom_jitter(aes(colour = rating)) ggplot(movies , aes(x = mpaa , y = rating)) + geom_jitter(aes(colour = rating)) + geom_boxplot() 61. 62.

  • ggplot
  • ggplot(data , aes(x, y)) + geom_()~~

63. qplot(x , y , data , geom = ())~~

  • Xlab , ylab , xlim , ylim, log
  • ggplot~+ geom_jitter() + geom_boxplot()

64. qplot geom = c(jitter , boxplot) c() 65. 66.

  • ggplot2
  • http://had.co.nz/ggplot2/
  • http://jasp.ism.ac.jp/~nakanoj/workshop10/2010Rmeeting.htm
  • http://had.co.nz/courses/10-tokyo/

SlideShare(Hadly Wickham)

  • http://www.slideshare.net/hadley/presentations

67. m(__)m