【问题标题】:How to resize plot title in ggdensity()?如何在 ggdensity() 中调整绘图标题的大小?
【发布时间】:2021-10-22 01:11:21
【问题描述】:

我认为这应该很容易,但我一直在努力修改每个情节的标题。我刚接触 R,所以我真的不知道如何编辑它。

正如您在图像中看到的那样,所有绘图标签都居中,但没有正确放置。一些字母被剪掉了。当我在一个图中组合 2 列时,这些标签由 ggdensity() 自动生成。

bell_shape <- lapply(slash_k, function(x) ggdensity(x, c("Mean_Lesion_Height", "Mean_Max_Lesion_Length"), 
                                                    combine = TRUE,
                                                    add = "mean", 
                                                    fill = "lightblue", 
                                                    x.text.angle = 360, 
                                                    color = "darkblue"))
pen_bell_shape <- ggarrange(plotlist = bell_shape, 
                            widths = 10, 
                            heights = 10, 
                            nrow = 2, 
                            ncol = 3,
                            labels = c("3.IR20", "5.IR20", "7.IR20", "3.TN1", "5.TN1", "7.TN1"),
                            font.label = list(size = 9, color = "red"))

我真的不知道如何编辑这个。我希望有人可以帮助我。

我试过了

bell_shape + theme(axis.title.x.top = c(size = 1, color ="block")

但它返回NULL

【问题讨论】:

    标签: r ggplot2 plot label ggpubr


    【解决方案1】:

    这个问题的解决方法是使用

    theme(strip.text())

    这里已经回答了这个问题:

    [https://stackoverflow.com/questions/3290330/facet-label-font-size] [https://stackoverflow.com/questions/2751065/how-can-i-manipulate-the-strip-text-of-facet-grid-plots] [https://stackoverflow.com/questions/2631780/r-ggplot2-can-i-set-the-plot-title-to-wrap-around-and-shrink-the-text-to-fit-t]

    这也是一个不错的选择

    [https://stackoverflow.com/questions/2631780/r-ggplot2-can-i-set-the-plot-title-to-wrap-around-and-shrink-the-text-to-fit- t]

    这也可以提供见解

    [https://stackoverflow.com/questions/37089052/r-ggplot2-facet-grid-how-include-math-expressions-in-few-not-all-labels]

    这里是如何更改构面标签

    [https://stackoverflow.com/questions/3472980/how-to-change-facet-labels]

    文档在这里

    [https://rpkgs.datanovia.com/ggpubr/reference/facet.html]

    【讨论】:

      猜你喜欢
      • 2017-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-17
      • 2012-07-27
      • 1970-01-01
      • 1970-01-01
      • 2016-04-23
      相关资源
      最近更新 更多