05 tips tricks

Click here to load reader

Post on 11-Nov-2014

1.781 views

Category:

Technology

0 download

Embed Size (px)

DESCRIPTION

 

TRANSCRIPT

  • 1. Stat405 Graphic tips & tricks Hadley Wickham Wednesday, 9 September 2009
  • 2. 1. Homework 2. Reading a scatterplot 3. Scatterplot techniques for large data 4. Iteration & story telling 5. Project & homework Wednesday, 9 September 2009
  • 3. Homework Great start! Remember the grading scheme: 4.55 = A+, 44.5 = A, 3.54 = A- Shorter is better than longer. Check aspect ratios. Read the comments! Wednesday, 9 September 2009
  • 4. Revision: reading a scatterplot Big patterns Small patterns Deviations from the pattern Strange patterns Wednesday, 9 September 2009
  • 5. Wednesday, 9 September 2009
  • 6. Strong linear relationship. A number of outliers. Wednesday, 9 September 2009
  • 7. Wednesday, 9 September 2009
  • 8. Unusual striations. Two groups? Little relationship between table and price? Wednesday, 9 September 2009
  • 9. Wednesday, 9 September 2009
  • 10. Curved (exponential?) relationship. Outliers mostly cheaper than expected. Wednesday, 9 September 2009
  • 11. But whats the problem with all these plots? qplot(carat, price, data = diamonds) Wednesday, 9 September 2009
  • 12. But whats the problem with all these plots? In pairs, brainstorm solutions for 2 minutes. qplot(carat, price, data = diamonds) Wednesday, 9 September 2009
  • 13. Ideas If x discrete, use boxplots. Use semi-transparent points. Divide into bins and count number of points in each bin (2d histogram). Display statistical summary. Wednesday, 9 September 2009
  • 14. Box and whisker plots Wednesday, 9 September 2009
  • 15. Boxplots Less information than a histogram, but take up much less space. Already seen them used with discrete x values. Can also use with continuous x values, by specifying how we want the data grouped. Wednesday, 9 September 2009
  • 16. qplot(table, price, data = diamonds) Wednesday, 9 September 2009
  • 17. 15000 10000 price 5000 50 60 70 80 90 qplot(table, price, data = diamonds, geom = "boxplot") table Wednesday, 9 September 2009
  • 18. 15000 10000 price 5000 qplot(table, price, data = diamonds, geom 80 "boxplot", 50 60 70 = 90 group = round(table)) table Wednesday, 9 September 2009
  • 19. 15000 10000 price 5000 One boxplot for each unique value of this aesthetic qplot(table, price, data = diamonds, geom 80 "boxplot", 50 60 70 = 90 group = round(table)) table Wednesday, 9 September 2009
  • 20. Alpha blending Wednesday, 9 September 2009
  • 21. qplot(carat, price, data = diamonds, alpha = I(1/10)) Wednesday, 9 September 2009
  • 22. qplot(carat, price, data = diamonds, alpha = I(1/50)) Wednesday, 9 September 2009
  • 23. qplot(carat, price, data = diamonds, alpha = I(1/250)) Wednesday, 9 September 2009
  • 24. Statistical summary Wednesday, 9 September 2009
  • 25. qplot(carat, price, data = diamonds) + geom_smooth() Wednesday, 9 September 2009
  • 26. qplot(log10(carat), log10(price), data = diamonds) + geom_smooth() Wednesday, 9 September 2009
  • 27. qplot(log10(carat), log10(price), data = diamonds) + geom_smooth(method = "lm") Wednesday, 9 September 2009
  • 28. 2d bins Wednesday, 9 September 2009
  • 29. # Very basic cleaning diamonds$x[diamonds$x == 0]