diff --git a/visualize.Rmd b/visualize.Rmd index 609c8d0..de09f56 100644 --- a/visualize.Rmd +++ b/visualize.Rmd @@ -163,15 +163,15 @@ ggplot(data = mpg) + Here, the color doesn't convey information about a variable, but only changes the appearance of the plot. To set an aesthetic manually, set the aesthetic by name as an argument of your geom function. You'll need to pick a value that makes sense for that aesthetic: -* the name of a color as a character string. -* the size of a point in mm. -* the shape as a point as a number, as shown below. +* The name of a color as a character string. +* The size of a point in mm. +* The shape of a point as a number, as shown below. -R has a set of 24 built-in shapes, identified by numbers: +R has a set of 25 built-in shapes, identified by numbers: ```{r echo = FALSE, out.width = "75%", fig.asp = 1/3} shapes <- tibble( - shape = c(0:19, 22, 21, 24, 23, 20), + shape = c(0, 1, 2, 5, 3, 4, 6:19, 22, 21, 24, 23, 20), x = (0:24 %/% 5) / 2, y = (-(0:24 %% 5)) / 4 ) @@ -186,6 +186,8 @@ ggplot(shapes, aes(x, y)) + theme(aspect.ratio = 1/2.75) ``` +Note that there are some seeming duplicates: 0, 15, and 22 are all squares. The difference comes from the interaction of the `colour` and `fill` aesthetics. The hollow shapes (0--14) have a border determined by `colour`; the solid shapes (15--18) are filled with `colour`; the filled shapes (21--24) have a border of `colour` and are filled with `fill`. + ### Exercises 1. What's gone wrong with this code? Why are the points not blue?