Malta
Malta

Reputation: 1983

how to give more space to ticks labels in R plotly

I have an horizontal bar diagram in r plotly, and I would like to give ticks labels more space. See the example below :

libelle <- c("financial activities","Agriculture, sylviculture and fishing","Manufacture of transport materials","financial activities","Agriculture, sylviculture and fishing","Manufacture of transport materials")
value <- c(15000000,987000,154000000,10000000,927000,15400000)
annee <- c("2011","2011","2011","2012","2012","2012")
data <- data.frame(libelle,value,annee)
plot_ly(data=data,x=value,y=libelle,group=annee,type="bar",orientation="h")

I can't see the labels on the left, and I haven't find how to move the vertical axis to the right.

Upvotes: 1

Views: 3077

Answers (1)

Adam Quek
Adam Quek

Reputation: 7153

m <- list(l=250, r=50, b=50, t=10, pad=4)
plot_ly(data=data,x=value,y=libelle,group=annee,type="bar",orientation="h") %>% layout(margin=m)

enter image description here

Upvotes: 6

Related Questions