More tweaks from @behrman
This commit is contained in:
parent
9cf3badbf0
commit
bd5a7a1c3a
|
@ -212,11 +212,6 @@ ggplot(shapes, aes(x, y)) +
|
|||
1. What happens if you set an aesthetic to something other than a variable
|
||||
name, like `displ < 5`?
|
||||
|
||||
1. Vignettes are long-form guides that document things about
|
||||
a package that affect many functions. ggplot2 has two vignettes.
|
||||
How can you find them and what do they describe? (Hint: Google is
|
||||
your friend.)
|
||||
|
||||
## Common problems
|
||||
|
||||
As you start to run R code, you're likely to run into problems. Don't worry --- it happens to everyone. I have been writing R code for years, and every day I still write code that doesn't work!
|
||||
|
@ -516,7 +511,7 @@ Stats are the most subtle part of plotting because you can't see them directly.
|
|||
is generated by counting rows.)
|
||||
|
||||
1. You might want to override the default mapping from transformed variables
|
||||
to aesthetics. For example, you might want to display a bar chart of
|
||||
to aesthetics. For example, you might want to display a bar chart of
|
||||
proportion, rather than count:
|
||||
|
||||
```{r}
|
||||
|
@ -615,8 +610,7 @@ You can avoid this gridding by setting the position adjustment to "jitter". `po
|
|||
|
||||
```{r}
|
||||
ggplot(data = mpg) +
|
||||
geom_point(mapping = aes(x = displ, y = hwy), position = "jitter") +
|
||||
ggtitle('Position = "jitter"')
|
||||
geom_point(mapping = aes(x = displ, y = hwy), position = "jitter")
|
||||
```
|
||||
|
||||
Adding randomness seems like a strange way to improve your plot, but while it makes your graph less accurate at small scales, it makes your graph _more_ revealing at large scales. Because this is such a useful operation, ggplot2 comes with a shorthand for `geom_point(position = "jitter")`: `geom_jitter()`.
|
||||
|
@ -680,8 +674,7 @@ There are a number of other coordinate systems that are occasionally helpful.
|
|||
width = 1
|
||||
) +
|
||||
theme(aspect.ratio = 1) +
|
||||
xlab(NULL) +
|
||||
ylab(NULL)
|
||||
labs(x = NULL, y = NULL)
|
||||
|
||||
bar + coord_flip()
|
||||
bar + coord_polar()
|
||||
|
@ -697,6 +690,8 @@ knitr::include_graphics("images/visualization-coordinate-systems.png")
|
|||
|
||||
1. Turn a stacked bar chart into a pie chart using `coord_polar()`.
|
||||
|
||||
1. What does `labs()` do? Read the documentation.
|
||||
|
||||
1. What's the difference between `coord_quickmap()` and `coord_map()`?
|
||||
|
||||
1. What does the plot below tell you about the relationship between city
|
||||
|
|
Loading…
Reference in New Issue