[英]Is there a way to hide Trace Names in Plotly (specifically R)?
我一直在絞盡腦汁想如何用 plotly 擺脫跟蹤名稱,但似乎找不到任何東西。 添加跟蹤名稱似乎是 plotly boxplots 的一個獨特功能。 我可以將它命名為“”,但我需要原始跡線名稱,以便在覆蓋標記時可以引用它。 我已盡可能簡化代碼以解決根本問題。 有沒有辦法隱藏跟蹤名稱?
housing = read.table("http://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data")
colnames(housing) = c("CRIM","ZN","INDUS","CHAS","NOX","RM","AGE","DIS","RAD","TAX","PTRATIO","B","LSTAT","MEDV")
housing %>%
plot_ly( x = ~RM,
type="box",
name = "RM",
showlegend = FALSE
) %>%
add_markers(x=6, y="RM",
marker = list(color = "blue", size = 15)
)
如果要在箱形圖中隱藏軌跡名稱,可以使用showticklabels = F
隱藏軸的標簽。
在下面的示例中,跟蹤名稱也通過設置hoverinfo = 'x'
隱藏在懸停標簽中。
library(plotly)
housing = read.table("http://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data")
colnames(housing) = c("CRIM","ZN","INDUS","CHAS","NOX","RM","AGE","DIS","RAD","TAX","PTRATIO","B","LSTAT","MEDV")
housing %>%
plot_ly( x = ~RM,
y = 'RM',
type="box",
name = "RM",
showlegend = FALSE,
hoverinfo = 'x'
) %>%
add_markers(x=6, y="RM",
marker = list(color = "blue", size = 15)
) %>% layout(yaxis = list(showticklabels = F))
housing
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.