小编Mar*_*iKo的帖子

使用 scale_linetype_manual 更改 ggplot 图中的一行

我试图将我的 ggplot 中的一行从破折号改为虚线,但我失败了,函数 scale_linetype_manual 不起作用。谁能帮我解决这个问题?

ggplot(d, aes(a,value)) + 
geom_line(aes(color = series), size=2)+
scale_y_continuous(breaks=seq(-2.5, 2.5, 2.5)) +
coord_cartesian(ylim=c(-2.5, 2.5))+
scale_x_continuous(breaks=seq(-200, 2000, 1000)) +
scale_color_manual(values=c("#E69F00","#56B4E9",  "#56B4E9")) +
scale_linetype_manual(values=c("twodash", "dotted", "dotted")) +
theme(legend.direction = 'vertical', 
    legend.position = 'right',
    legend.key = element_rect(size = 7),
    legend.key.size = unit(3, 'lines'))+
theme(panel.grid.major = element_blank(), text = element_text(size=30), 
 panel.grid.minor = element_blank(),
    panel.background = element_blank(), axis.line = element_line(colour = 
 "black"))+
   geom_vline(xintercept=c(0), linetype="dotted", size=1.5)+
 geom_rect(data=rect, aes(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax),
        color="gray55",
        alpha=0.4,
        inherit.aes = FALSE)+
labs(x = "time [ms]",
   y = …
Run Code Online (Sandbox Code Playgroud)

r line ggplot2

3
推荐指数
1
解决办法
4431
查看次数

标签 统计

ggplot2 ×1

line ×1

r ×1