简体   繁体   English

R散点图中的三维散点图仍为空

[英]3d scatter plot remains empty in R plotly

I have a simple question regarding a 3d scatter plot using the plotly package in R. It appears all of the plots are working with the exception of the 3d scatter and line plots. 我有一个简单的问题,关于使用R中的plotly包的三维散点图。看起来所有的图都在工作,除了三维散点图和线图。 To test this I've tried the following code (= taken from the cheat sheet): 为了测试这个,我尝试了以下代码(=从备忘单中获取):

library(plotly)

plot_ly(type = "scatter3d", x = c(9,8,5,1), y = c(1,2,4,8),z = c(11,8,15,3),
        mode = "markers")

在此输入图像描述

I ended up with a plot containing only the axis and not the actual points. 我最终得到的图表只包含轴而不是实际点。 To troubleshoot I've added colors which got me confused as the legend with the color scale did appear but not the points themselves. 为了排除故障,我添加了让我感到困惑的颜色,因为带有颜色标度的图例确实出现了但不是点数本身。 I did notice the axis have the wrong scale ((80,-80),(60,-60),(100,-100)). 我注意到轴的刻度错误((80,-80),(60,-60),(100,-100))。

Furthermore, the 3d surface plot en 2d scatter plot examples worked perfectly. 此外,3d表面图和2d散点图示例完美地工作。

(Posted on behalf of the OP) . (代表OP发布)

I reverted to the older package (4.5.6 was found to be working), please find the script below: 我恢复到旧包(4.5.6被发现工作),请找到下面的脚本:

require(devtools)
install_version("plotly", version = "4.5.6", repos = "http://cran.us.r-project.org")

Is that what you are looking forward? 那是你期待的吗? 在此输入图像描述

> plot_ly(type = "scatter3d", x = c(9,8,5,1), y = c(1,2,4,8),z = c(11,8,15,3),
+         mode = "markers")

There is no error with your code, clear your R-consel and try again and check the version of the library as well. 您的代码没有错误,清除您的R-consel并再次尝试并检查库的版本。

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

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