如何为R中的刻度标签提供更多空间

时间:2016-05-23 06:09:10

标签: r graph plotly

我在r中有一个水平条形图,我想给刻度标签更多空间。请参阅以下示例:

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

我看不到左边的标签了,我还没有找到如何将垂直轴向右移动。

1 个答案:

答案 0 :(得分:5)

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