parent
33d7e6e543
commit
9cc1ec2f57
|
@ -476,7 +476,7 @@ On the x-axis, the chart displays `cut`, a variable from `diamonds`. On the y-ax
|
|||
* __boxplots__ calculate the quartiles of your data and then plot the
|
||||
quartiles as a box.
|
||||
|
||||
ggplot2 calls the algorithm that a graph uses to calculate new values a __stat__, which is short for statistical transformation. Each geom in ggplot2 is associated with a default stat that it uses to calculate values to plot. The figure below describes how this process works with `geom_bar()`.
|
||||
ggplot2 calls the algorithm that a graph uses to calculate new values, a __stat__, which is short for statistical transformation. Each geom in ggplot2 is associated with a default stat that it uses to calculate values to plot. The figure below describes how this process works with `geom_bar()`.
|
||||
|
||||
```{r, echo = FALSE, out.width = "100%"}
|
||||
knitr::include_graphics("images/visualization-stat-bar.png")
|
||||
|
@ -490,7 +490,7 @@ knitr::include_graphics("images/visualization-stat-point.png")
|
|||
|
||||
You can learn which stat a geom uses, as well as what variables it computes by visiting the geom's help page. For example, the help page of `geom_bar()` shows that it uses the count stat and that the count stat computes two new variables, `count` and `prop`.
|
||||
|
||||
Stats are the most subtle part of plotting because you can't see them directly. ggplot2 applies the transformation and stores the results behind the scenes. You only see impact in the final plot. Generally, you don't need to think about stats: the defaults work away on your behalf to summarise your data as needed for a particular plot. However, there are two cases where you might need to know about it:
|
||||
Stats are the most subtle part of plotting because you can't see them directly. ggplot2 applies the transformation and stores the results behind the scenes. You only see the impact in the final plot. Generally, you don't need to think about stats: the defaults work away on your behalf to summarise your data as needed for a particular plot. However, there are two cases where you might need to know about them:
|
||||
|
||||
1. You might want to override the default stat. In the code below, I change
|
||||
the stat of `geom_bar()` from count (the default) to identity. This lets
|
||||
|
|
Loading…
Reference in New Issue