Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 为什么plotly不识别调色板?_R_Colors_Plotly - Fatal编程技术网

R 为什么plotly不识别调色板?

R 为什么plotly不识别调色板?,r,colors,plotly,R,Colors,Plotly,我有一个非常简单的图形要绘制,为此我想使用library(RColorBrewer)的调色板 使用示例代码时: plot_ly(iris, x = ~Petal.Length, y = ~Petal.Width, type="scatter", mode = "markers",color = ~Species , marker=list( size=20 , opacity=0.5) ) 一切正常。但是,在使用我的数据时: plot_ly(data, x = ~z, y = ~

我有一个非常简单的图形要绘制,为此我想使用library(RColorBrewer)的调色板

使用示例代码时:

plot_ly(iris, x = ~Petal.Length, y = ~Petal.Width,  type="scatter", mode = "markers",color = ~Species , 
    marker=list( size=20 , opacity=0.5)  )
一切正常。但是,在使用我的数据时:

plot_ly(data, x = ~z, y = ~pagerank_persistence,  type="scatter", mode = "markers",color = ~Species,marker=list( size=20 , opacity=0.5)  )
R只是说:eval中的错误(expr、envir、enclose):对象“物种”nicht gefunden(翻译为:未找到对象“物种”)

数据如下所示,其中z是日期代码

head(data)
  z degree_in_persistence pagerank_persistence tradeprofit_persistence pfprofit_persistence
2 15371                   0.8                 0.70                    0.00                          0.05
3 15400                   0.8                 0.80                    0.15                 0.05
4 15431                   0.8                 0.85                    0.30                 0.00
5 15461                   0.7                 0.70                    0.30                 0.00
6 15492                   0.8                 0.80                    0.00                 0.00
7 15522                   0.8                 0.90                    0.00                 0.00


非常感谢您的帮助!

您使用的是什么
示例代码
?您的代码中有
颜色=~Species
,但数据中没有
物种
。因此
未找到物种
是有意义的。
物种
虹膜
数据中的一列。您希望您的绘图如何着色?谢谢-这确实解决了问题显然是个问题!