首页 > 解决方案 > 强制向日葵图从 x=0 开始

问题描述

为逻辑回归创建向日葵图时,x 轴从 2 开始。我可以更改此行为以使 x 轴从 0 开始吗​​?我已经尝试通过更改 x 轴来手动更改它,但这并没有使 x=0 可见(参见#c1)。

当前的向日葵图图像,从 x=2 开始;

在此处输入图像描述

# EE contains the Likert Scale values
EE.min <- min(EE)
EE.max <- max(EE)
EE.x <- seq(EE.min, EE.max, length = 500)
New.EE <- data.frame(EE = EE.x)

# Creating prediction
EE.p <- predict(logit, New.EE, type = "response")
sunflowerplot(EE, cb, main = "Effort Expectancy",
              xlab= "EE (5-point Likert-Scale)", ylab="Likelihood", yaxt="n", xaxt="n")

# c1:
axis(1, at = seq(0,5,0.5), labels = c(0, 0.5, 1, 1.5, 2, 2.5 , 3, 3.5, 4, 4.5, 5), las=1)
axis(2, at = seq(0,1,0.2), labels = c("No = 0", 0.2, 0.4, 0.6, 0.8, "Yes = 1"), las = 2)
abline(h = seq(0,1,0.2), lty = 2)
lines(EE.x, EE.p)

标签: r

解决方案


sunflowerplot有一个xlim关于 x 轴范围的参数。

相比

sunflowerplot(iris$Sepal.Length, iris$Sepal.Width)

sunflowerplot(iris$Sepal.Length, iris$Sepal.Width, xlim = c(0, 20))

推荐阅读