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

Marna Wagley marna.wagley at gmail.com
Thu Dec 24 09:15:59 CET 2015

Hi R user,
I was trying to make a figure for each of four sites. Each site has 7
classes, among the 7 classes, one is average. I am wondering how I can
change the color and size of the line that was average value. I want to
highlight average value.

Similarly, I have been using smooth function therefore I want to highlight
the smoothed line but still I want to show a original data with gray
colour. I tried it different ways but I could not change the line style (or
size) and colour. would you please give me a suggestion on how I can solve
the problem?

I used the following code.

> unique(dat$site)
[1] SiteA SiteC SiteB SiteD
Levels: SiteA SiteB SiteC SiteD

> unique(dat$variable)
[1] D       C       E       Average F       A       B
Levels: A Average B C D E F
A<-ggplot(data=dat, aes(x=Year, y=value, group = variable, colour =
variable)) +geom_line()+theme_bw()+stat_smooth() A+facet_wrap(~ site,

	[[alternative HTML version deleted]]

More information about the R-help mailing list