gpt4 book ai didi

r - 在 ggplot2 中使面标签水平

转载 作者:行者123 更新时间:2023-12-02 02:51:54 27 4
gpt4 key购买 nike

我希望分面图右侧标签上的名称是水平的,这样它们就不会被切断。例如,它显示北英格兰、东米德兰兹等。

Image here:

最佳答案

您可以使用strip.text.y = element_text(angle = 0)旋转右侧的小面条。我正在使用 iris 数据集来制作一个可重现的示例。

library(ggplot2)

ggplot() +
geom_line(data= iris, aes(x = Sepal.Length, y = Petal.Width,
colour = Species), stat = "identity") +
facet_wrap(Species ~ ., strip.position = "right", ncol = 1, scales = "free_y") +
theme_bw() +
theme(strip.text.y = element_text(angle = 0),
legend.position = "none")

关于r - 在 ggplot2 中使面标签水平,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61824026/

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