You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The legend in Figure \@ref(fig:03-scatter-color-by-category)
712
712
takes up valuable plot area.
713
-
We can improve this by moving the legend title using the `legend.position`
714
-
argument of the `theme` function.
715
-
Here we set it to `"bottom"` to put the legend beneath the plot.
713
+
We can improve this by moving the legend title using the `legend.position`
714
+
and `legend.direction`
715
+
arguments of the `theme` function.
716
+
Here we set `legend.position` to `"top"` to put the legend above the plot
717
+
and `legend.direction` to `"vertical"` so that the legend items remain
718
+
vertically stacked on top of each other.
719
+
When the `legend.position` is set to either `"top"` or `"bottom"`
720
+
the default direction is to stack the legend items horizontally.
721
+
However, that will not work well for this particular visualization
722
+
because the legend labels are quite long
723
+
and would run off the page if displayed this way.
716
724
717
725
```{r 03-scatter-color-by-category-legend-edit, warning=FALSE, fig.height=5.5, fig.cap = "Scatter plot of percentage of Canadians reporting a language as their mother tongue vs the primary language at home colored by language category with the legend edited."}
0 commit comments