首页 > 解决方案 > plot_ly:如何水平绘制子图?

问题描述

我无法用plot_ly、scatter3d 创建一个子图,每个图并排在水平线上。

library(plotly)
mtcars$am[which(mtcars$am == 0)] <- 'Automatic'
mtcars$am[which(mtcars$am == 1)] <- 'Manual'
mtcars$am <- as.factor(mtcars$am)

fig1 <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec, color = ~am, colors = c('#BF382A', '#0C4B8E'), type = "scatter3d", mode = "markers")
fig2 <- plot_ly(mtcars, x = ~hp, y = ~wt, z = ~qsec, color = ~am, colors = c('#BF382A', '#0C4B8E'), type = "scatter3d", mode = "markers")
subplot(fig1, fig2)

在此处输入图像描述 我错过了什么?

标签: rplotlysubplot

解决方案


推荐阅读