Change comma and thousand separator in tick labels

走远了吗. 提交于 2019-12-19 09:02:27

问题


In a chart like the one below I wan to change the thousand separator to a dot ".", but I don't know how to use the tickformat parameter in order to get it.

require(plotly)
p <- plot_ly(x=~c(2012,2013,2014,2015,2016), y=~c(1200000,975000,1420000,1175000,1360000), type='bar') %>%
     layout(yaxis = list(title="Income in €", tickformat=",d", gridcolor = "#bbb"), xaxis = list(title="Year"), margin=list(l=80))
p


回答1:


As far as I know if you use tickformat, separators gets ignored. So you can either specify your tickformat or your separators.

require(plotly)
p <- plot_ly(x=~c(2012, 2013, 2014, 2015, 2016), y=~c(1200000, 975000, 1420000, 1175000, 1360000), type = 'bar') %>%
  layout(separators = '.,', 
         yaxis = list(title='Income in Euro'))
p



来源:https://stackoverflow.com/questions/43436009/change-comma-and-thousand-separator-in-tick-labels

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!