Skip to content

Commit

Permalink
Merge pull request #109 from fhdsl/facts
Browse files Browse the repository at this point in the history
Adjust size of plot axis labels
  • Loading branch information
carriewright11 authored Jul 16, 2024
2 parents 13b2680 + 9061404 commit 3e75968
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions modules/Factors/Factors.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Let's make a plot first.
er_visits_age_subset %>%
ggplot(mapping = aes(x = AGE, y = RATE)) +
geom_boxplot() +
theme_bw(base_size = 8) # make all labels size 8
theme_bw(base_size = 12) # make all labels size 12
```

OK this is very useful, but it is a bit difficult to read. We expect the values to be plotted by the order that we know, not by alphabetical order.
Expand Down Expand Up @@ -159,7 +159,7 @@ Now let's make our plot again:
er_visits_age_fct %>%
ggplot(mapping = aes(x = AGE, y = RATE)) +
geom_boxplot() +
theme_bw(base_size = 8)
theme_bw(base_size = 12)
```

Now that's more like it! Notice how the data is automatically plotted in the order we would like.
Expand Down Expand Up @@ -216,7 +216,7 @@ library(forcats)
er_visits_age_fct %>%
ggplot(mapping = aes(x = AGE, y = RATE)) +
geom_boxplot() +
theme_bw(base_size = 8)
theme_bw(base_size = 12)
```

This would be useful for identifying easily which age group to focus on.
Expand All @@ -242,7 +242,7 @@ er_visits_age_fct %>%
ggplot(mapping = aes(x = fct_reorder(AGE, RATE, mean), y = RATE)) +
geom_boxplot() +
labs(x = "Age Category") +
theme_bw(base_size = 8)
theme_bw(base_size = 12)
```

## forcats for ordering.. with `.desc = ` argument{.smaller}
Expand All @@ -254,7 +254,7 @@ er_visits_age_fct %>%
ggplot(mapping = aes(x = fct_reorder(AGE, RATE, mean, .desc = TRUE), y = RATE)) +
geom_boxplot() +
labs(x = "Age Category") +
theme_bw(base_size = 8)
theme_bw(base_size = 12)
```

## forcats for ordering.. can be used to sort datasets
Expand Down
22 changes: 11 additions & 11 deletions modules/Factors/Factors.html

Large diffs are not rendered by default.

Binary file modified modules/Factors/Factors.pdf
Binary file not shown.

0 comments on commit 3e75968

Please sign in to comment.