作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 ggplot2 中有一个简单的图,想添加一条虚线回归线。到目前为止,我有:
library(ggplot2)
ggplot(mtcars, aes(x = hp, y = mpg)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
theme_bw()
scale_linetype_manual()
但我的尝试一直很糟糕。
最佳答案
根据帮助页面(参见 ?geom_smooth
),线型是 geom_smooth 理解的美学之一。
因此,您可以调整使用 geom_smooth(method = "lm", se = FALSE, linetype="dashed")
library(ggplot2)
ggplot(mtcars, aes(x = hp, y = mpg)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, linetype = "dashed") +
theme_bw()
关于r - 在 ggplot2 中使用 geom_smooth 绘制虚线回归线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34230679/
我想创建这样的情节: 这里我们有两个变量 X = midyear 和 Y = yearend。我想为 Y 的 X 的每个级别创建密度图。 我可以做到这一点,但看起来并不像我想象的那样,特别是情节和线条
我正在尝试在数据框的行上应用公式来获取行中数字的趋势。 下面的示例在使用 .apply 的部分之前一直有效。 df = pd.DataFrame(np.random.randn(10, 4), col
我是一名优秀的程序员,十分优秀!