r - 如何更改趋势线的线型(ggplot)
问题描述
我使用以下命令来创建我的图:
AfterLatency <- ggplot(
After,
aes(
x = After$X7.Days.Time.in.Blank,
y = After$X7.Days.Latency.to.Leave,
shape = factor(Treatment),
color = factor(Treatment)
)
) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
xlab("Time in Blank (s)") +
ylab("Latency to leave (s)")
我试过这个:AfterLatency + scale_linetype_manual("Treatment", values=c("Control"=2, "Sertraline"=4))
并且还尝试linetype
在 geom_smooth 中包含该命令,但均未成功。
解决方案
尝试添加linetype
作为geom_smooth
.
geom_smooth(method = 'lm', se = FALSE, aes(linetype = Treatment))
此外,不需要After$
. 如果在几何图形中使用其他映射,这很有用。
推荐阅读
- windows - 检测是否启用了 TESTSIGNING
- python - 如何在棉花糖中为 Int 字段设置下限
- postgresql - 使用 CascadeType.PERSIST 插入外键为 null,- Spring Data Jpa
- c# - 将键发送到未聚焦的窗口
- spring-boot - spring-boot-starter-data-mongodb 似乎不包含要使用 @PrePersist @PreUpdate 的 persistence-api
- python - POST 请求失败“无法验证 CSRF 令牌”(Python 3)
- javascript - 如何正确地将结果保存在变量中?XLSX 角
- javascript - 如何将背景从静态 jpg 更改为动画 gif 图片,但仅在脚本完成后
- date - Linux date 命令自动为每个日期时间增加 10 小时
- c++ - Hackerrank “Abort Called”:不知道怎么回事[C++]