Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate labels using Plotly in R

Tags:

r

plotly

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

`

Thank you.

like image 602
DarkSide Avatar asked Aug 24 '16 07:08

DarkSide


Video Answer


1 Answers

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"))
like image 70
KST Avatar answered Oct 12 '22 20:10

KST