我正在使用plotly生成3D散点图,请参见下面的示例代码:
library(plotly)
mtcars$am[which(mtcars$am == 0)] <- 'Automatic'
mtcars$am[which(mtcars$am == 1)] <- 'Manual'
mtcars$am <- as.factor(mtcars$am)
p <- plot_ly(mtcars,
x = ~wt,
y = ~hp,
z = ~qsec,
color = ~am,
colors = c('#BF382A', '#0C4B8E')) %>%
add_markers() %>%
layout(scene = list(xaxis = list(title = 'Weight'),
yaxis = list(title = 'Gross horsepower'),
zaxis = list(title = '1/4 mile time')),
title = "Example plot")
当我下载剧情的静态图像时,图像顶部没有空格,标题看起来几乎被切掉了。有没有一种方法可以调整3D图上的边距以解决此问题?尝试通过指定layout
来调整边距会产生错误:
'scatter3d' objects don't have these attributes: 'margin'
答案 0 :(得分:0)
也许您试图在错误的位置添加[object HTMLInputElement]
。确实可以执行以下操作:
margin