I want to change the default thickness of geom_line
using the size aesthetic. This question has already been answered here but the solution – to set the default value using update_geom_defaults
does not work for me.
Here’s a minimum reproducible example:
library(tidyverse)
update_geom_defaults("line", list(size = 2))
data(ChickWeight)
ChickWeight %>%
filter(Chick %in% c("1", "2", "3")) %>%
ggplot(aes(x = Time, y = weight, colour = Chick)) +
geom_line()
The result I get is:
update_geom_defaults
does work for changing e.g. the default colour. Any idea what’s going on here and how to successfully change the default size?
>Solution :
You could use linewidth
to change the thickness like this:
library(tidyverse)
update_geom_defaults("line", list(linewidth = 2))
data(ChickWeight)
ChickWeight %>%
filter(Chick %in% c("1", "2", "3")) %>%
ggplot(aes(x = Time, y = weight, colour = Chick)) +
geom_line()
Created on 2023-02-02 with reprex v2.0.2