From 8c91a43aeead9dcd42702bdd7ff2a2c0274ce96c Mon Sep 17 00:00:00 2001 From: Mitsuo Shiota <48662507+mitsuoxv@users.noreply.github.com> Date: Thu, 20 Apr 2023 09:52:40 +0900 Subject: [PATCH] Fix/communication probably typos (#1439) * no need for \n before str_wrap(), and a typo * "col" can work, but may be confusing for readers --- communication.qmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/communication.qmd b/communication.qmd index 2299d8f..ed02c80 100644 --- a/communication.qmd +++ b/communication.qmd @@ -243,13 +243,13 @@ To demonstrate using `annotate()`, let's create some text to add to our plot. The text is a bit long, so we'll use `stringr::str_wrap()` to automatically add line breaks to it given the number of characters you want per line: ```{r} -trend_text <- "Larger engine sizes tend to\nhave lower fuel economy." |> +trend_text <- "Larger engine sizes tend to have lower fuel economy." |> str_wrap(width = 30) trend_text ``` Then, we add two layers of annotation: one with a label geom and the other with a segment geom. -The `x` and `y` aesthetics in both define where the annotation should start, and the `xend` and `yend` aesthetics in the segment annotation define the starting location of the end location of the segment. +The `x` and `y` aesthetics in both define where the annotation should start, and the `xend` and `yend` aesthetics in the segment annotation define the end location of the segment. Note also that the segment is styled as an arrow. ```{r} @@ -468,10 +468,10 @@ base + theme(legend.position = "right") # the default base + theme(legend.position = "left") base + theme(legend.position = "top") + - guides(col = guide_legend(nrow = 3)) + guides(color = guide_legend(nrow = 3)) base + theme(legend.position = "bottom") + - guides(col = guide_legend(nrow = 3)) + guides(color = guide_legend(nrow = 3)) ``` If your plot is short and wide, place the legend at the legend at the top or bottom, and if it's tall and narrow, place the legend at the left or right.