1

我正在尝试绘制最终结果。我已将响应变量转换为

expon=^0.2

以获得描述效果的回归线。我不想用曲线来说明效果,我想保持直线并在 y 轴上放置一个指数刻度。我是否忽略了帮助页面中的某个部分?

到目前为止的相关输入是:

expon = 0.2 ## best fit for assumptions AND correlation 
tempMin = 0
dmaxDS_Summer_noSO4$response = dmaxDS_Summer_noSO4$TempChange^expon

plot(response[ind & !indClosed&!indLarge]~Sunshine[ind &!indClosed&!indLarge], 
  exp="y",data=dmaxDS_Summer_noSO4,pch=21,col="red",
  main='All Small Sites',ylab="Temperature Change^0.2",xlab="Sunshine Hrs")
abline(a[1]a[5]lwd=3,col="red")

任何指针将不胜感激。

4

1 回答 1

0

您可以使用log函数的参数plot。请看下面的代码:

# Data Simulation
expon <- 0.2 ## best fit for assumptions AND correlation 
tempMin <- 0

dmaxDS_Summer_noSO4 <- data.frame(TempChange  = 0.2 ^ 0:100 , Sunshine = 0:100 %/% 12)
dmaxDS_Summer_noSO4$response = dmaxDS_Summer_noSO4$TempChange ^ expon
ind = seq_along(nrow(dmaxDS_Summer_noSO4))
indClosed = FALSE 
indLarge = FALSE

# Plotting
plot(response[ind & !indClosed & !indLarge] ~ Sunshine [ind & !indClosed & !indLarge], 
     data = dmaxDS_Summer_noSO4,
     pch = 21,
     col = "red",
     main = "All Small Sites",
     ylab = "Temperature Change ^ 0.2",
     xlab = "Sunshine Hrs",
     log = "y")

输出: 绘图输出

于 2018-09-05T15:59:08.717 回答