Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R_basis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CAN
R_basis
Commits
62a49c9e
Commit
62a49c9e
authored
6 months ago
by
Gilquin
Browse files
Options
Downloads
Patches
Plain Diff
fix: correct missing legend in section 2.7
replace get_plot_component by get_legend in last exercise of section 2.7
parent
e83b491a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
session_2/session_2.Rmd
+3
-3
3 additions, 3 deletions
session_2/session_2.Rmd
with
3 additions
and
3 deletions
session_2/session_2.Rmd
+
3
−
3
View file @
62a49c9e
...
...
@@ -644,7 +644,7 @@ You can learn more features about `cowplot` on [https://wilkelab.org/cowplot/art
Use the `cowplot` documentation to reproduce this plot and save it.
:::
```{r, echo=F}
```{r, echo=F
, warning=FALSE
}
p1 <- ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, color = class)) +
geom_point() +
theme_bw()
...
...
@@ -654,7 +654,7 @@ p2 <- ggplot(data = new_mpg, mapping = aes(x = cty, y = hwy, color = class)) +
theme_bw()
p_row <- plot_grid(p1 + theme(legend.position = "none"), p2 + theme(legend.position = "none"), labels = c("A", "B"), label_size = 12)
p_legend <- get_
plot_compon
en
t
(p1
, "
guide
-box-top", return_all = TRUE
)
p_legend <- get_
leg
en
d
(p1
+
guide
s(color = guide_legend(nrow = 2))
)
plot_grid(p_row, p_legend, nrow = 2, rel_heights = c(1, 0.2))
```
...
...
@@ -671,7 +671,7 @@ p2 <- ggplot(data = new_mpg, mapping = aes(x = cty, y = hwy, color = class)) +
theme_bw()
p_row <- plot_grid(p1 + theme(legend.position = "none"), p2 + theme(legend.position = "none"), labels = c("A", "B"), label_size = 12)
p_legend <- get_
plot_compon
en
t
(p1
, "
guide
-box-top", return_all = TRUE
)
p_legend <- get_
leg
en
d
(p1
+
guide
s(color = guide_legend(nrow = 2))
)
p_final <- plot_grid(p_row, p_legend, nrow = 2, rel_heights = c(1, 0.2))
p_final
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment