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
|
1. What happens if you set an aesthetic to something other than a variable
|
||||||
name, like `displ < 5`?
|
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
|
## 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!
|
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!
|
||||||
|
@ -615,8 +610,7 @@ You can avoid this gridding by setting the position adjustment to "jitter". `po
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
ggplot(data = mpg) +
|
ggplot(data = mpg) +
|
||||||
geom_point(mapping = aes(x = displ, y = hwy), position = "jitter") +
|
geom_point(mapping = aes(x = displ, y = hwy), position = "jitter")
|
||||||
ggtitle('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()`.
|
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
|
width = 1
|
||||||
) +
|
) +
|
||||||
theme(aspect.ratio = 1) +
|
theme(aspect.ratio = 1) +
|
||||||
xlab(NULL) +
|
labs(x = NULL, y = NULL)
|
||||||
ylab(NULL)
|
|
||||||
|
|
||||||
bar + coord_flip()
|
bar + coord_flip()
|
||||||
bar + coord_polar()
|
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. 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's the difference between `coord_quickmap()` and `coord_map()`?
|
||||||
|
|
||||||
1. What does the plot below tell you about the relationship between city
|
1. What does the plot below tell you about the relationship between city
|
||||||
|
|
Loading…
Reference in New Issue