ggplot2 Increase Color Palette Intensity
Confession: LLM (GLM-5.1) gave me a right direction.
Using scater::plotColData() function I create a violin plot of colData() of a
TreeSummarizedExperiment object. However, the colors were a bit bleak and
barely visible on the screen. ggplot2
book provides
a solution using scale_fill_hue() function.
scale_colour_hue(
h.start = 0,
c = 150, # Increase intensity of colors
l = 55,
...
) +
You can experiment with different c (chroma) and l (luminance) values.
plotColData(
tse,
"shannon_diversity",
"id",
color_by = "treatment",
shape_by = "timepoint"
) +
labs(x = "Id", y = "Shannon diversity") +
scale_colour_hue(
h.start = 0,
c = 150, # Increase intensity of colors
l = 55,
name = "Treatment and timepoint",
) +
guides(shape = guide_legend(title = "Timepoint")) +