需要在底部绘制颜色栏

时间:2018-08-08 05:47:32

标签: r plotly r-plotly

这是一个数据框,使用plotly绘制的图

我仔细阅读了《 Rally参考指南》中提到的属性,但束手无策。

require(plotly)  
require(dplyr)

df <- structure(list(nn = c(5, 10, 20), Sparsity = c(93.7, 94.3, 94.9
), Method = c("adjcos", "adjcos", "adjcos"), Filtering = c("IBCF", 
"IBCF", "IBCF"), error = c("MAE", "MAE", "MAE"), `5` = c(0.716433082, 
0.746625993, 0.786221009), `10` = c(0.709316631, 0.737244112, 
0.784197414), `20` = c(0.711888414, 0.73875951, 0.783307894), 
    `30` = c(0.716054462, 0.741430884, 0.78574634), `50` = c(0.722296008, 
    0.745516396, 0.788986052), `70` = c(0.727236608, 0.749367689, 
    0.792077439), `100` = c(0.73261171, 0.75337796, 0.795475065
    ), `150` = c(0.738988515, 0.75764295, 0.799090637), `200` = c(0.743606268, 
    0.760689524, 0.801416126)), row.names = c(NA, -3L), class = c("tbl_df", 
"tbl", "data.frame"))

plot_ly(x = ~df$Sparsity, y = ~df$nn, z = ~as.matrix(df[,-c(1:5)])) %>%
  add_surface()

我获得的情节

enter image description here

我需要在图的底部直接从plot_ly()渲染的颜色条/比例尺(在此处引用colorbar attributes)。

  

如下所示:

enter image description here

0 个答案:

没有答案