# Setup base plot
p <- plot3js(
xlim = c(-10, 10),
ylim = c(-5, 5),
zlim = c(-8, 8)
)
# Add sphere (this will look distorted because of axis scaling)
p <- sphere3js(
data3js = p,
0, 0, 0,
radius = 5,
col = "green"
)
r3js(p, zoom = 2.5)
# Setup base plot with equal aspect ratio
p <- plot3js(
xlim = c(-10, 10),
ylim = c(-5, 5),
zlim = c(-8, 8),
aspect = c(1, 1, 1)
)
# Add sphere (fixed aspect ratio now makes the sphere look spherical)
p <- sphere3js(
data3js = p,
0, 0, 0,
radius = 5,
col = "green"
)
r3js(p, zoom = 2)
Run the code above in your browser using DataLab