如何解决如何使用 ggplot2 和 ggpubr 全局更改标签的大小和颜色?
我使用 ggarrange
包中的 ggpubr
在一个数组中有 3 个图。标签的大小和字体可以在 ggarrange()
函数中修改,正如我在 MWE 中展示的那样。有没有办法在全局范围内进行此修改,可能在 theme_set()
或 theme()
内进行,以便它适用于所有地块?
library(ggplot2)
library(ggpubr)
p <- ggscatter(iris,x = "Sepal.Length",y = "Sepal.Width",color = "Species",palette = "jco",ggtheme = theme_minimal())
ggarrange(p,p,ncol = 3,common.legend = TRUE,labels = c("a","b","c"),font.label = list(size = 15,color = "red"))
解决方法
一种选择是制作一个小包装器,在引擎盖下使用您想要的默认值调用 from pathlib import Path
def get_commit(repo_path):
git_folder = Path(repo_path,'.git')
head_name = Path(git_folder,'HEAD').read_text().split('\n')[0].split(' ')[-1]
head_ref = Path(git_folder,head_name)
commit = head_ref.read_text().replace('\n','')
return commit
r = get_commit('PATH OF YOUR CLONED REPOSITORY')
print(r)
并且可以轻松地应用于您的所有图:
ggarrange
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。