geom_abline在ggplot2 r软件包中与geom_dotplot不符合GEOM_DOTPLOT
这个问题与ggplot2 r软件包有关。为什么使用GEOM_DOTPLOT绘制的斜率数量会截断Geom_abline的截距?尝试以下示例:
testdata <- data.frame(predictor = c(0,1), dependent = c(0,2))
testplot <- ggplot(NULL) +
geom_dotplot(data = testdata, aes(x = factor(predictor), y = dependent), binaxis = "y", stackdir = "center") +
geom_abline(aes(intercept = 0, slope = 2))
testplot #The line is off
testplot <- ggplot(NULL) +
geom_dotplot(data = testdata, aes(x = factor(predictor), y = dependent), binaxis = "y", stackdir = "center") +
geom_abline(aes(intercept = 0 - 2, slope = 2))
testplot #The line aligns with the dots as expected
这是一个错误还是我在做愚蠢的事情?谢谢。
The question relates to ggplot2 R package. Why is the intercept of the geom_abline off by the amount of the slope when drawn with the geom_dotplot? Try the following examples:
testdata <- data.frame(predictor = c(0,1), dependent = c(0,2))
testplot <- ggplot(NULL) +
geom_dotplot(data = testdata, aes(x = factor(predictor), y = dependent), binaxis = "y", stackdir = "center") +
geom_abline(aes(intercept = 0, slope = 2))
testplot #The line is off
testplot <- ggplot(NULL) +
geom_dotplot(data = testdata, aes(x = factor(predictor), y = dependent), binaxis = "y", stackdir = "center") +
geom_abline(aes(intercept = 0 - 2, slope = 2))
testplot #The line aligns with the dots as expected
Is this a bug or me doing something silly? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论