0

Could anyone please help with adding a smoother to "BB" series only. I tried stat_smooth(), but it automatically adds smooth line to both series. Below is the code for demonstration purposes:

data1 = melt(data, id = 'Year')
ggplot(data1, aes(x = Year, y = value,colour=variable)) + 
  geom_line() + 
  ylab(label="Index") + 
  xlab("Year") + 
  scale_colour_manual(values = c("red", "blue"),labels = c("BR", "BB"))+ theme(legend.position=c(0.8,0.9),legend.title=element_blank(),legend.background = element_rect(fill=NULL))+
  ggtitle("TITLE")

enter image description here

Karolis Koncevičius
  • 9,417
  • 9
  • 56
  • 89
london
  • 115
  • 4
  • 1
    Your question does not contain a [reproducible example](http://stackoverflow.com/q/5963269/4303162). It is therefore hard to understand your problem and give you an appropriate answer. Please make your data available (e.g. by using `dput()`) or use one of the example data sets in R. Also, add the minimal code required to reproduce your problem to your post. – Stibu Mar 09 '16 at 20:48
  • 1
    You can subset your data in `stat_smooth`. Something like `stat_smooth(data = subset(data1, variable == "BB")`. – Stibu Mar 09 '16 at 20:53
  • Thanks! Works flawlessly – london Mar 10 '16 at 15:05

0 Answers0