gpt4 book ai didi

r - 图中的多行 y 标签

转载 作者:行者123 更新时间:2023-12-04 12:04:35 26 4
gpt4 key购买 nike

有没有办法在 R 图中为 y 轴创建多线标签?

我试过添加 \n换行符应该在哪里,但是标签的第一行被剪掉了:

l <- 10
plot(0:l, (0:l), type='l',
yaxt='n',
xlab='Index',
ylab='Cumulative sum\nof the sorted weights')

Result of plot
tikzDevice 都会发生这种情况并在 RStudio 内部。另外,我尝试了一些 par()没有运气的选项。如何正确操作?

(超大的上边距也困扰着我......)

最佳答案

您需要使用 mar 设置边距或 mgp :

l <- 10
op <- par(mar=c(5, 6, 4, 2) + 0.1)
plot(0:l, (0:l), type='l',
yaxt='n',
xlab='Index',
ylab='Cumulative sum\nof the sorted weights')
par(op)

enter image description here

关于r - 图中的多行 y 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10686189/

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