rrglplot3d

Control space between data lines in a 3D plot


I am new on Stack Overflow. I have a 3D plot, like in this topic : R : plot multiple chronicles separated on 3d plot

Here is a reproducible example (edited) :

library(rgl)

# example data
Month <- rep(1:12, times = 7)
Year <- rep(1998:2004, each = 12, times = 1)
Sat <- rnorm(84)
df <- data.frame(Month, Year, Sat)
df

rgl::plot3d(df, type = "l", xlim = c(0, 1.5), ylim = c(1998,2004), ylab = "Year", col = "blue")
sapply(2:7, function(i) plot3d(df, add = TRUE,type = "l", col = "blue"))
grid3d(c("x", "y+", "z"))
grid3d(side, at = NULL, col = "gray", lwd = 1, lty = 1, n = 2)

enter image description here

lines are really close to each other. I would like to enlarge space between data lines. How can I do that?

Thanks for your responses.


Solution

  • It's not clear what you intended to show in your plot. You have xlim = c(0, 1.5), but then plot values from 1:12 which cause the plot to expand.

    If you want to restore the roughly equal sized sides of the plot region, you can call aspect3d(1,1,1) at the end, and it will reshape. Alternatively, specify an xlim range that covers the range of the data.

    If you want to clip values of x that are outside the range from 0 to 1.5, then you can call clipplanes3d(-1, 0, 0, 1.5). However, that doesn't work well with the grids; they probably won't end up in the right place.