【发布时间】:2020-09-23 09:27:30
【问题描述】:
我想在情节中将大数字分隔符从逗号更改为空白。我可以在 ggplot2 中执行此操作,但不能在 plotly 中执行此操作。它可能应该通过 tickformat 选项 (https://plotly.com/r/reference/#layout-xaxis-tickformat) 来完成,但是在尝试了此处指定的一些 d3 格式后:https://github.com/d3/d3-format/blob/master/README.md 我不明白。
例如,在下图中:
diamonds %>%
plot_ly(x=~clarity,y=~~depth*10000) %>%
add_bars()
我不想在 y 轴上有“50K”、“40K”,而是“50 000”、“40 000”。
如果我添加
layout(yaxis=list(tickformat=","))
我得到“50,000”、“40,000”...
如果我添加
layout(yaxis=list(tickformat=" "))
我得到“50000”、“40000”...
但我无法获得空格分隔符。
layout(yaxis=list(tickformat=","))
【问题讨论】: