0

I'm aware of this question where dcarlsen helpfully explains how to rotate a 3dscatterplot around the z-axis in r. However, I would also like to rotate around the x axis. Code:

attach(dataset)
dateconverted <- as.Date(Date)
Status_converted <- as.factor(Vaccine_status)
age <- as.numeric(gsub("([0-9]+).*$", "\\1", Declared_age))
scatterplot3d(dateconverted[4500:5115], age[4500:5115], New_cases[4500:5115], color=c("red","blue","green")[Status_converted[4500:5115]], pch=19, angle=75)

It gives something along the lines of:

Graph

Obviously there's tons of work to be done on the graph but I'd like to rotate the front upwards (around the x-axis).

Peter
  • 11,500
  • 5
  • 21
  • 31
anonymous2
  • 219
  • 7
  • 21

1 Answers1

1

You can try other libraries that generate even more dynamic graphics, an example of which you can see here:

library(rgl)
library(ggplot2)
library(knitr)
library(rglwidge)

plot3d(
  mtcars$wt,
  mtcars$disp,
  mtcars$mpg,
  type = "s",
  size = 1,
  lit = TRUE,
  main = "Car Weight Vs Engine Displacement Vs Mileage",
  sub = "3-D Plot"
)