DarkSide
DarkSide

Reputation: 167

Rotate labels using Plotly in R

I am trying to put vertically xlab in a plot using Plotly package. I want to do the same as "las= 2" on standard R.

I found 'tickangle = 45' but it is for ticks, not for labels.

Any one can help me?

   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"))

Upvotes: 8

Views: 11935

Answers (1)

KST
KST

Reputation: 637

In your case, you can add tickangle in xaxis:

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

Upvotes: 19

Related Questions