【发布时间】:2020-07-31 11:35:05
【问题描述】:
我如何获得短条的 dr5 和 dr3 的 文本大小?如果文本长于栏跨度,我希望文本溢出栏的末尾。
我尝试在布局中使用 uniformtext,但这会将所有文本缩小为正在使用的最小字体。如何将所有字体更改为正在使用的最大尺寸?
library(plotly)
# Test long text and short bars
xValues <- c("loooooooooooooooooonnnnnngg","lonnnnnnnnnnggggggg",
"dr3","dr4","dr5")
yValues <- c(0.5,1,2,0.22,10)
bar <- plot_ly(x = yValues,
y = xValues) %>%
add_trace(
type = 'bar',
orientation = 'h',
text = xValues,
textangle = 360,
textposition = "inside",
insidetextanchor = "start",
showlegend = F) %>%
layout(
yaxis = list(zeroline = FALSE,showline = FALSE,showticklabels = FALSE),
uniformtext = list(mode = "show")
)
bar
【问题讨论】:
标签: r layout plotly bar-chart r-plotly