2016-08-24 130 views
2

我试图把垂直xlab放在使用Plotly包的图中。我想在标准R上做同样的“las = 2”。使用Plotly旋转标签R

我发现'tickangle = 45',但它是用于刻度而不是标签。

任何人都可以帮助我吗?

` plot_ly(x = account$country, 
      opacity = 0.6, 
      type = "histogram", 
      histnorm = "probability", 
      color = c('More than One account'), 
      colors = 'red') %>% 

      add_trace(x = account2$country, 
         opacity = 0.6, 
         type = "histogram", 
         histnorm = "probability", 
         color = c('Account'), 
         colors='blue') %>% 

      layout(barmode="overlay", 
        title = "Clients test", 
        xaxis = list(title = "Country", color ="red"), 
        yaxis = list(title = "Clients")) 

`

谢谢。

回答

3

在你的情况,你可以在x轴添加tickangle:

layout(barmode="overlay", 
       title = "Clients test", 
       xaxis = list(title = "Country", color ="red", tickangle = 90), 
       yaxis = list(title = "Clients"))