Home > Software engineering >  How to set default size for `geom_line` in ggplot?
How to set default size for `geom_line` in ggplot?

Time:02-03

I want to change the default thickness of geom_line using the size aesthetic. This question has already been answered Line plot - size is still 1

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?

CodePudding user response:

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

  • Related