如何给R中的刻度标签留出更多空间 [英] how to give more space to ticks labels in R plotly

查看:126
本文介绍了如何给R中的刻度标签留出更多空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

推荐答案

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)

这篇关于如何给R中的刻度标签留出更多空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆