adjust_legend_title | R Documentation |
Adjust legend
adjust_legend_title(
plot,
title = ggplot2::waiver(),
fontsize = NULL,
family = NULL,
face = NULL,
color = "black",
...
)
adjust_legend_position(plot, position = "right")
plot |
A |
title |
Legend title. |
fontsize |
Font size in points. Defaults to |
family |
Font family |
face |
Font face ("plain", "italic", "bold", "bold.italic") |
color |
A hex color for the stroke color. For example, |
... |
Arguments passed on to |
position |
The position of the legend. Can be one of
|
The title
argument of adjust_legend_title()
supports plotmath expressions to include special characters.
See examples and Advanced plotting.
A tidyplot
object.
# Plot without adjustments
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar()
# New title
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_legend_title("My new legend title")
# New title with plotmath expression
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_legend_title("$E==m*c^{2}$")
# Alternative legend positions
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_legend_position("left")
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_legend_position("top")
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_legend_position("bottom")
# `position = "none"` hides the legend
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points_beeswarm() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_legend_position("none")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.