我看过类似的问题,我觉得我已经做了一切。仍然没有得到期望的输出。我正在使用ggplot2和tidyquant包来可视化具有 2 个财务趋势的数据我正在尝试显示一个包含趋势线颜色图的图例
data %>%
ggplot(aes(date, price)) +
geom_line() +
geom_ma(ma_fun = SMA, n = 50, size = 1 , col = "red" , show.legend = TRUE)+
geom_ma(ma_fun = SMA, n = 200, size = 1 , col = "blue", show.legend= TRUE)+
theme_tq()