问题
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