[R] to change the size of the line in the plot created in ggplot2

Giorgio Garziano giorgio.garziano at ericsson.com
Thu Dec 24 18:48:20 CET 2015


Hi Marna,

I prepared this toy example that should help you.

x <- seq(1:100)
y <- x*x
avg <- mean(y)
avg.v <- rep(avg,100) # your average column data
df <- as.data.frame(cbind(x, y, avg.v))

library(ggplot2)
ggplot(data=df[,-3], aes(x=x, y=y)) + geom_line() +
  geom_line(data=df[,c(1,3)], color='blue', aes(x=x, y=avg))


Best,

--
GG

	[[alternative HTML version deleted]]



More information about the R-help mailing list