Rough first pass at summaries for all whole game chapters
This commit is contained in:
@@ -15,8 +15,6 @@ R has several systems for making graphs, but ggplot2 is one of the most elegant
|
||||
ggplot2 implements the **grammar of graphics**, a coherent system for describing and building graphs.
|
||||
With ggplot2, you can do more and faster by learning one system and applying it in many places.
|
||||
|
||||
If you'd like to learn more about the theoretical underpinnings of ggplot2, you might enjoy reading "The Layered Grammar of Graphics", <https://vita.had.co.nz/papers/layered-grammar.pdf>, the scientific paper that discusses the theoretical underpinnings..
|
||||
|
||||
### Prerequisites
|
||||
|
||||
This chapter focuses on ggplot2, one of the core packages in the tidyverse.
|
||||
@@ -139,7 +137,8 @@ We will begin with the `<MAPPINGS>` component.
|
||||
> "The greatest value of a picture is when it forces us to notice what we never expected to see." --- John Tukey
|
||||
|
||||
In the plot below, one group of points (highlighted in red) seems to fall outside of the linear trend.
|
||||
These cars have a higher fuel efficiency than you might expect. That is, they have a higher miles per gallon than other cars with similar engine sizes.
|
||||
These cars have a higher fuel efficiency than you might expect.
|
||||
That is, they have a higher miles per gallon than other cars with similar engine sizes.
|
||||
How can you explain these cars?
|
||||
|
||||
```{r}
|
||||
@@ -1303,3 +1302,20 @@ knitr::include_graphics("images/visualization-grammar-3.png")
|
||||
|
||||
You could use this method to build *any* plot that you imagine.
|
||||
In other words, you can use the code template that you've learned in this chapter to build hundreds of thousands of unique plots.
|
||||
|
||||
If you'd like to learn more about this theoretical underpinnings of ggplot2, you might enjoy reading "[The Layered Grammar of Graphics](https://vita.had.co.nz/papers/layered-grammar.pdf)", the scientific paper that describes the theory of ggplot2 in detail.
|
||||
|
||||
## Summary
|
||||
|
||||
In this chapter, you've learn the basics of data visualization with ggplot2.
|
||||
We started with the basic idea that underpins ggplot2: a visualization is a mapping from variables in your data to aesthetic properties like position, colour, size and shape.
|
||||
You then learned about facets, which allow you to create small multiples, where each panel contains a subgroup from your data.
|
||||
We then gave you a whirlwind tour of the geoms and stats which control the "type" of graph you get, whether it's a scatterplot, line plot, histogram, or something else.
|
||||
Position adjustment control the fine details of position when geoms might otherwise overlap, and coordinate systems allow you fundamentally change what `x` and `y` mean.
|
||||
|
||||
We'll use visualizations again and again through out this book, introducing new techniques as we need them.
|
||||
If you want to get a comprehensive understand of ggplot2, we recommend reading the book, [*ggplot2: Elegant Graphics for Data Analysis*](https://ggplot2-book.org).
|
||||
Other useful resources are the [*R Graphics Cookbook*](https://r-graphics.org) by Winston Chang and [*Fundamentals of Data Visualization*](https://clauswilke.com/dataviz/) by Claus Wilke.
|
||||
|
||||
With the basics of visualization under your belt, in the next chapter we're going to switch gears a little and give you some practical workflow advice.
|
||||
We intersperse workflow advice with data science tools throughout this part of the book because it'll help you stay organize as you write increasing amounts of R code.
|
||||
|
||||
Reference in New Issue
Block a user