考虑以下示例,其中明确设置了级别顺序:
library(plotly)
iris$sp <- factor(iris$Species, c("versicolor", "setosa", "virginica"))
二维散点图遵循因子水平的顺序:
plot_ly(data = iris,
x = ~sp,
y = ~Sepal.Width,
type = "scatter",
mode = "markers",
marker = list(opacity = 0.6, size = 4))
3D散点图没有:
plot_ly(data = iris,
x = ~sp,
y = ~Sepal.Length,
z = ~Sepal.Width,
type = "scatter3d",
mode = "markers",
marker = list(opacity = 0.6, size = 4))
问题:如何使plotly
“ scatter3d”遵守R中因子水平的顺序?
现在看来,这些级别在3D图中已按字符串排序。 是虫子吗?还是故意制造的?