Skip to content

Commit

Permalink
Merge pull request #53 from moj-analytical-services/remove_duplicate_…
Browse files Browse the repository at this point in the history
…plot

Condense slides with duplicate plot into one
  • Loading branch information
pbbgss authored Oct 31, 2024
2 parents 7679fb2 + 27e621e commit 96a5326
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
5 changes: 0 additions & 5 deletions R_code_participant.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, colour = class)) +
ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, colour = year)) +
ggplot2::geom_point()

# You can also use shapes to distinguish between categories
ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, shape = class, colour = class)) +
ggplot2::geom_point()

# Some aesthetics are only suitable in certain situations
ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, shape = class, colour = class)) +
ggplot2::geom_point()

Expand Down
13 changes: 2 additions & 11 deletions index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,14 @@ ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, colour = year)) +

---

You could also use shapes to distinguish between categories, such as vehicle class.
You could also use the point shape to distinguish between categories. For example, we use it here in addition to colour to show the vehicle class.

But, what's wrong with this plot?
```{r, fig.height=4, fig.width=8}
# You can also use shapes to distinguish between categories
ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, shape = class, colour = class)) +
ggplot2::geom_point()
```

---

Some aesthetics are only suitable in certain situations. For example, using `shape` for `class` isn't appropriate as, by default, shape only supports 6 distinct categories (you can override this manually). Notice what has happened to "suv" here:
```{r, fig.height=4, fig.width=8}
# Some aesthetics are only suitable in certain situations
ggplot2::ggplot(data = mpg, aes(x = displ, y = hwy, shape = class, colour = class)) +
ggplot2::geom_point()
```
But note there is a problem: suv is missing from the plot because by default, shape only supports six categories (you can override this manually). Some aesthetics are only suitable in certain situations.

## Scale functions

Expand Down
17 changes: 3 additions & 14 deletions index.html

Large diffs are not rendered by default.

0 comments on commit 96a5326

Please sign in to comment.