adjust_colors | R Documentation |
Adjust colors
adjust_colors(
plot,
new_colors = NULL,
saturation = 1,
labels = tidyplot_parse_labels(),
downsample = c("evenly", "first", "last", "middle"),
...
)
plot |
A |
new_colors |
A character vector of new hex colors to use. Can be a named character vector of hex colors to assign certain data labels to specific colors. |
saturation |
A |
labels |
One of the options below. Please note that when
|
downsample |
If too many colors are provided, whether to downsample |
... |
Arguments passed on to the ggplot2 |
A tidyplot
object.
colors_discrete_friendly()
, colors_continuous_viridis()
, colors_diverging_blue2brown()
, and new_color_scheme()
# Plot without adjustments
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar()
# Provide hex colors
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_colors(new_colors = c("#644296","#F08533","#3B78B0", "#D1352C"))
# Provide discrete color scheme
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_colors(new_colors = colors_discrete_seaside)
# Provide named vector
study |>
tidyplot(x = treatment, y = score, color = treatment) |>
add_data_points() |>
add_mean_bar(alpha = 0.4) |>
add_sem_errorbar() |>
adjust_colors(new_colors = c(
"A" = "pink",
"B" = "purple",
"C" = "grey",
"D" = "blue"))
# Provide continuous color scheme
climate |>
tidyplot(x = month, y = year, color = max_temperature) |>
add_heatmap() |>
adjust_colors(new_colors = colors_continuous_turbo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.