更改刻度标签中的逗号和千位分隔符

Alf*_*hez 6 r plotly

在像下面这样的图表中,我想将千位分隔符更改为点“.”,但我不知道如何使用该tickformat参数来获取它。

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
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

Max*_*ers 5

据我所知,如果您使用tickformat,separators会被忽略。因此,您可以指定您的tickformat或您的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
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明