I am having some issues using the scatter3d
function, specifically that it seems to be impossible to dictate to the function what the limits of the axis should be. Here's my basic plotting function with a few datapoints from the set I'm working with:
library(rgl)
library(plot3D)
library(car)
df <- data.frame(meanX = c(147.34694, 173.89244, 135.73004, 121.93766,
109.72152, 92.53709, 165.46588, 169.77744,
127.01796, 99.34347),
meanY = c(140.40816, 110.99128, 134.56023, 164.18703,
166.04051, 155.97329, 105.29377, 104.42683,
130.17066, 155.99696),
avgDist = c(40.788118, 12.957329, 14.24348, 39.10424,
34.694258, 25.532335, 21.491695,23.528944,
9.309201, 31.916879))
car::scatter3d(x = df$meanX, y = df$meanY, z = df$avgDist, surface = FALSE)
This plots fine, but sets up default axis ranges of
xlim = c(90,200)
ylim = c(100,200)
zlim = c(9,40)
The problem is, thatIi seem to be completely unable to change this. I know that RGL does not allow clipping, and I don't want it to exclude any data points here, but the axis range is quite a bit higher than the maximum value of each axis
max(df$meanX)
[1] 173.8924
max(df$meanY)
[1] 166.0405
max(df$avgDist)
[1] 40.78812
What I'd like to do, is to set the axis limit on both X and Y from 70 to 185, from what I can tell, this SHOULD be possible with this code:
car::scatter3d(x = df$meanX, y = df$meanY, z = df$avgDist, surface = FALSE,
xlim = c(70,185), ylim = c(70,185))
But this just produces the same plot (with no errors or warnings). Anyone know how to manually set these axis?