2

I have created a scatterplot3d with a linear model applied.

Unfortunately the results of the LM are subtle and need to be emphasised, my question is how can I extend the LM grid outside of the 'cube'.

Plot:

enter image description here

Code:

Plot1 <-scatterplot3d(

              d$MEI,   
              d$YYYYMM,     
              d$AOELog10,
              pch=20,
              grid = FALSE,
              color = "black",
              xlab="MEI",
              ylab="Date",
              zlab="AOE Log(10)"

                       )


fit <- lm(d$AOELog10 ~ d$MEI+d$Rank) 
Plot1$plane3d(fit)

Now I guess it might be a variable within lm(), but I cant find anything....

Methexis
  • 2,739
  • 5
  • 24
  • 34

1 Answers1

1

To see a larger region, or region of interest, specify the x, y, and z limits in the scatterplot command.

library(scatterplot3d)
d<-data.frame(MEI=runif(200,-3,3),
              YYYYMM=runif(200,1,300),
              AOELog10=runif(200,1,20),
              Rank=runif(200,1,5))
fit <- lm(d$AOELog10 ~ d$MEI+d$Rank) 
Plot1 <-scatterplot3d(
  d$MEI, d$YYYYMM, d$AOELog10,
  pch=20, grid = FALSE, color = "black",
  xlab="MEI", ylab="Date", zlab="AOE Log(10)",
  main="baseline"
)
Plot1$plane3d(fit)

Plot2 <-scatterplot3d(
  x=d$MEI, y=d$YYYYMM, z=d$AOELog10,
  pch=20, grid = FALSE, color = "black",
  xlab="MEI", ylab="Date", zlab="AOE Log(10)",
  xlim = c(-5,5), ylim = c(-50,400), zlim = c(-10,50),  # Specify the plot range
  main="larger region"
)
Plot2$plane3d(fit)