r - 手动将图例添加到 ggplot2 绘图
问题描述
我正在尝试向下面显示的图和数据集添加图例。我已经尝试了这里建议的一些修复,但它似乎不起作用。非常感谢您的帮助!
ggplot()+
geom_point(data = Bacteria.Killing.Master, aes(x=Conc, y=X1121.2), color = "deepskyblue4", size = 3, shape = 16 )+
geom_line(data = Bacteria.Killing.Master, aes(x=Conc, y=X1121.2), color = "deepskyblue4")+
geom_point(data = Bacteria.Killing.Master, aes(x=Conc, y=X1121.5), color = "indianred4", size = 3, shape = 18)+
geom_line(data = Bacteria.Killing.Master, aes(x=Conc, y=X1121.5), color = "indianred4")+
geom_point(data = Bacteria.Killing.Master, aes(x=Conc, y=X1121.7), color = "springgreen4", size = 3, shape = 15)+
geom_line(data = Bacteria.Killing.Master, aes(x=Conc, y=X1121.7), color = "springgreen4")+
labs(y = "Bacterial Cells/mL", x = "Concentration of H2O2", color = "Legend")+
theme(plot.title = element_text(hjust = 0.5))+
ggtitle("H2O2 Bacteria Killing")+
scale_color_manual(values = c("deepskyblue4", "indiannred4", "springgreen4"))
解决方案
推荐阅读
- sql-server - 使用 XPath 从 XML 中排除孙子
- java - 在 Fix4.4 中更改标签 31
- python - 如何使用 *args 和 **kwargs 注释可调用对象?
- php - 如何在php数组json中使用curl发送帖子数据
- github - 是否可以找到与使用 Github API 相关的项目板?
- hibernate - 将继承策略从 InheritanceType.JOINED 转换为 InheritanceType.SINGLE_TABLE 时出现 DuplicateMappingException
- amazon-web-services - travis-ci 无法解析 yml 文件
- php - 亚马逊产品广告 API 的 TooManyRequestsException
- python - 如何在odoo中更新列表时在方法内退出ZeroDivisionError?
- html - 如何在html中选择随机单词