【问题标题】:Increase the space between x axis labels ggplot?增加x轴标签ggplot之间的空间?
【发布时间】:2018-07-01 10:58:11
【问题描述】:

这是我的 ggplot,我需要调整 x 轴标签之间的间距并使绘图更大。请告知这里缺少什么?尝试使用 expand 但没有任何运气:

ggplot(device_contacts_jaccard_android_ios, aes(x = factor(uuid_lev), y = j, fill = factor(android))) +
  geom_boxplot() +
  facet_wrap( ~ dt) +
  scale_x_discrete(expand=c(0, 0.5)) +
  theme(axis.text.x = element_text(angle = -90, hjust = 0))

我在这里查看了其他答案,没有人解决我的问题,如果我错了,请纠正我。

【问题讨论】:

    标签: r ggplot2


    【解决方案1】:

    使用ggsavepdf(...);...; dev.off() 增加图像的输出大小。一旦你这样做,轴文本标签之间的空间应该增加。例如,您还可以使用element_text(size = 7) 减小字体。

    请注意,ggsave(..., size, width) 默认以英寸为单位。好的起点是width = 8height = 8。如果您想更改单位,请尝试ggsave(..., units = "cm")

    【讨论】:

    • 非常感谢您的回答,但在如此强大的包中我不能只是将情节扩大,这不是很奇怪吗?我应该使用 plotly 代替吗?
    猜你喜欢
    • 1970-01-01
    • 2023-03-06
    • 2017-02-05
    • 1970-01-01
    • 2021-03-14
    • 2016-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多