所有标签最终都使用相同的颜色,并带有以下最小示例:
plot_ly(
data = mtcars,
type = "scatter3d",
mode = "markers",
colors = c("blue","red"),
text = row.names(mtcars),
hoverinfo = "text",
color = ~cyl,
x = ~disp,
y = ~hp,
z = ~qsec
)
可以通过以下方式实现:
plot_ly(
data = mtcars,
type = "scatter",
mode = "markers",
colors = c("blue","red"),
text = row.names(mtcars),
hoverinfo = "text",
color = ~cyl,
x = ~disp,
y = ~hp
)
在这个示例中,我知道图例的颜色范围不合适,但是对于本代码使用的实际数据来说,它是必需的。