首页 > 解决方案 > 在绘图图中隐藏范围滑块()中的文本

问题描述

有没有办法text在主图表中显示唯一而不是在rangeslider()没有完全显示的地方?

library(plotly)
x <- c('Product A', 'Product B', 'Product C')
y <- c(20, 14, 23)
text <- c('27% market share', '24% market share', '19% market share')
data <- data.frame(x, y, text)


fig <- plot_ly(data, x = ~x, y = ~y, type = 'bar',
               text = y, textposition = 'outside',
               # rotate label
               textangle = 90,
               marker = list(color = 'rgb(158,202,225)',
                             line = list(color = 'rgb(8,48,107)', width = 1.5)))
fig <- fig %>% layout(title = "January 2013 Sales Report",
                      xaxis = list(rangeslider=list(),fixedrange=T, title = ""),
                      yaxis = list(rangeslider=list(),fixedrange=T,title = ""))

fig

标签: rplotly

解决方案


推荐阅读