ggplot2,如何只为一个变量添加更平滑

时间:2016-03-09 20:39:54

标签: r ggplot2 smoothing

任何人都可以帮助添加更顺畅的" BB"仅限系列。我尝试stat_smooth(),但它会自动为两个系列添加平滑线。以下是用于演示目的的代码:

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

0 个答案:

没有答案