简体   繁体   English

围绕 X 轴旋转 scatterplot3d

[英]Rotate scatterplot3d around X axis

I'm aware of this question where dcarlsen helpfully explains how to rotate a 3dscatterplot around the z-axis in r.我知道这个问题,dcarlsen 有助于解释如何在 r 中围绕 z 轴旋转 3dscatterplot。 However, I would also like to rotate around the x axis.但是,我也想绕 x 轴旋转。 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:它提供了以下内容:

图形

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).显然,图表上有大量工作要做,但我想将前面向上旋转(围绕 x 轴)。

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"
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM