使用R中的Plotly旋转标签

Da*_*de 4 r plotly

我试图使用Plotly包将xlab垂直放入绘图中.我想和标准R上的"las = 2"做同样的事情.

我发现'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"))
Run Code Online (Sandbox Code Playgroud)

`

谢谢.

小智 7

在您的情况下,您可以在xaxis中添加tickangle:

layout(barmode="overlay",
               title = "Clients test",
               xaxis = list(title = "Country", color ="red", tickangle = 90),
               yaxis = list(title = "Clients"))
Run Code Online (Sandbox Code Playgroud)