r - geom_smooth 与 R 中的字符串
问题描述
我有一个变量要用于 ggplots 中的 y 轴,它必须作为它的“”名称传递(出于类似原因,我可以在那里使用一些变量并希望改变 y 轴标签来反映它)。
但我也想在图表上绘制一条平滑线。
ggplot(data=iris, aes(x=Sepal.Width, col=Species)) +
geom_point(aes_string(y="Petal.Length")) +
geom_smooth(method="lm", formula=y~x, se=F)
给Error: stat_smooth requires the following missing aesthetics: y
. 有什么办法吗?
解决方案
推荐阅读
- python - 没有渐变的抗锯齿?
- java - 我们可以从 java.security.KeyStore 对象及其密钥对和证书中提取特定别名,然后注入新的 java.security.KeyStore 对象吗?
- python - 强制 pipenv (重新)从 github 安装一个包,即使版本没有改变
- javascript - 如何从嵌入式 youtube 播放列表中禁用“相关视频”
- java - 将服务帐户(json 文件)位置传递给 application.properties
- wordpress - 为什么我在创建新页面时看不到我的自定义模板?
- javascript - Firebase 实时数据库不返回任何数据
- mysql - 数据核对
- python - 根据另一个列表从熊猫数据框列中的列表中删除值
- java - 新创建的字符串在哪里?堆内存还是字符串常量池?