How to adjust linewidth for a line already plotted?

How do I adjust the linewidth, e.g. decrease from 2 for a plot already created to a new plot with linewidth 1?

library(ggplot2)

df <- data.frame(x = seq(1, 10, 1),
                 y = seq(1, 10, 1))

p <- ggplot(df, aes(x, y)) +
  geom_line(linewidth = 2)

p +
  geom_line(linewidth = 1)

In ggplot2, you can adjust the linewidth for an existing plot by modifying the corresponding aesthetic values within the geom_line() layer. Here's how you can decrease the linewidth from 2 to 1 for an existing plot: Follow gold whatsapp for more update
library(ggplot2)

df <- data.frame(x = seq(1, 10, 1),
y = seq(1, 10, 1))

p <- ggplot(df, aes(x, y)) +
geom_line(linewidth = 2)

Create a new plot with adjusted linewidth

p +
geom_line(linetype = "solid", size = 1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.