2017-04-16 131 views
2

在下面的图表中,我想将千位分隔符更改为点“。”,但我不知道如何使用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 

enter image description here

回答

2

据我所知,如果你使用tickformatseparators被忽略。所以你可以指定你的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 

enter image description here

+0

好!如果我使用'separators =“,那么小数点分隔符就是逗号,千位分隔符是点号,但是在这种情况下,我怎样才能在刻度标签中显示所有数字的全部数字,而不是缩写? –

+0

你无法据我所知。对我来说看起来像一个bug。 –

+0

这个问题已经存在一个bug:https://github.com/plotly/plotly.js/issues/1264 –

相关问题