gpt4 book ai didi

r - 如何更改 patchwork 中 tag_levels 的颜色和大小

转载 作者:行者123 更新时间:2023-12-03 08:17:39 24 4
gpt4 key购买 nike

我们想使用拼凑来更改标签的颜色和大小,但没有发生任何变化

library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) + geom_bar(aes(gear)) + facet_wrap(~cyl)
# Add title, etc. to a patchwork
p1 + p2 + plot_annotation('This is a title', caption = 'made with patchwork')
# Change styling of patchwork elements
p1 + p2 +
plot_annotation(
title = 'This is a title',
caption = 'made with patchwork',
theme = theme(plot.title = element_text(size = 16,color="red"))
)
# Add tags to plots
p1 / (p2 | p3) +
plot_annotation(tag_levels = 'A',theme = theme(plot.tag = element_text(color = "red")))

最佳答案

随着网站中描述的“&”合成,它似乎工作得很好。

p1 / (p2 | p3) +
plot_annotation(tag_levels = 'A') &
theme(plot.tag = element_text(color = "red"))

enter image description here

关于r - 如何更改 patchwork 中 tag_levels 的颜色和大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68857890/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com