R中的ggplot:图例

时间:2018-12-04 14:27:47

标签: r ggplot2 legend

有人知道为什么使用下面的代码时图中没有图例出现?

sp500400_percentiles_mkt <- ggplot(sp500400_all_mkt_Y,aes(x=date)) +
  geom_line(aes(y=sp500400_mkt_rblowvolatility_returns_bottom_pf_cum_2), linetype="solid")+
  geom_line(aes(y=sp500400_mkt_rblowvolatility_returns_medium_pf_cum_2), linetype="dashed")+
  geom_line(aes(y=sp500400_mkt_rblowvolatility_returns_top_pf_cum_2), linetype="dotted")+
  theme_classic()+
  theme(legend.position="bottom")+
  labs(title="Cumulative Returns: Investment of $1 in February 1998")+
  # labs(x="Year")+
  # labs(y="Cumulative Return")+
  theme(plot.title=element_text(hjust=0, size=10))+
  theme(axis.text.x = element_text(angle = 0, vjust = 0.5),axis.text=element_text(size=8))+
  scale_y_continuous(name=NULL, breaks=seq(0.00,3.00,0.2), 
                     expand=c(0,0), limits=c(0,3.00))+
  scale_x_date(name=NULL, date_breaks="1 years", date_labels="%b
  %y")

0 个答案:

没有答案