简体   繁体   English

关闭R中的绘图3D Scatterplot标记指示器

[英]Turn off plotly 3D Scatterplot marker indicators in R

在此处输入图片说明 What are the lines called (in the API) which extend from a marker to the respective axis when you hover over a marker? 当您将鼠标悬停在标记上时,从标记延伸到相应轴的线(在API中)是什么? Is there a way to turn those off? 有没有办法将其关闭?

library(plotly)

itemName = c("Alpha", "Bravo", "Charley", "Delta", "Echo", "Foxtrot") 
security = c(0.8583241, 0.7516891, 0.5390520, 0.4569594, 0.3228843, 0.1722286) 
miniX = c(-885.108, -1030.000, -805.889, -695.755, -887.871, -640.986) 
miniY   = c(-445.135, -298.563, -797.709, -806.598, -963.091, -1010)
miniZ   = c(423.694, 417.075, 616.456, 571.223, 575.304, 412.72)

df = data.frame(itemName, security, miniX, miniY, miniZ)

# set a range of colors
colors <- c('#f42f28', '#f2e30e', '#2d9b37', '#31a6f3') 


######### set up 3d scatter plot  #########
p1 <- plot_ly(df, 
             x = miniX, 
             y = miniY, 
             z = miniZ, 
             mode = "markers", 
             size = security, 
             color = security, 
             colors = colors,
             marker = list(symbol = 'circle', sizemode = 'diameter'), sizes = c(10, 20),
             text = paste('Item:', itemName, '<br>Security:', security),
             hoverinfo = "none"
) %>%
  add_markers() %>%
  layout(title = 'Locales',
         scene = list(xaxis = list(title = '', autorange = TRUE, showgrid = FALSE, zeroline = FALSE, showline = FALSE, autotick = TRUE, ticks = '', showticklabels = FALSE),
                      yaxis = list(title = '', autorange = TRUE, showgrid = FALSE, zeroline = FALSE, showline = FALSE, autotick = TRUE, ticks = '', showticklabels = FALSE),
                      zaxis = list(title = '', autorange = TRUE, showgrid = FALSE, zeroline = FALSE, showline = FALSE, autotick = TRUE, ticks = '', showticklabels = FALSE)
         )
  )

# Output the plot
p1

the correct answer here is to set showspikes = FALSE inside the scene list: 正确的答案是在场景列表中设置showspikes = FALSE:

 scene = list(xaxis = list(title = '', autorange = TRUE, showspikes = FALSE, showgrid = FALSE, zeroline = FALSE, showline = FALSE, autotick = TRUE, ticks = '', showticklabels = FALSE),
              yaxis = list(title = '', autorange = TRUE, showspikes = FALSE, showgrid = FALSE, zeroline = FALSE, showline = FALSE, autotick = TRUE, ticks = '', showticklabels = FALSE),
              zaxis = list(title = '', autorange = TRUE, showspikes = FALSE, showgrid = FALSE, zeroline = FALSE, showline = FALSE, autotick = TRUE, ticks = '', showticklabels = FALSE)

showspikes is not showing in the autocomplete, nor is it taked about within the documentation in the 3d scatterplot section. showspikes不会显示在自动完成中,也不会在3d散点图部分的文档中进行。

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

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