gpt4 book ai didi

r - 保存到文件后,情节被切断

转载 作者:行者123 更新时间:2023-12-03 17:06:45 28 4
gpt4 key购买 nike

我的无花果在情节之外有一个很大的传说。 6 行长描述 当我保存它时,图例不显示。我调整了标准,但它仍然不起作用。

legend("topright", inset=c(-0.6,0),xpd=TRUE,cex=0.8,
+legend=c("A_all peaks","B_ from all peaks","C_from all peaks","A_from unique peaks",
+"B_from unique peaks","C_from unique peaks",
+"A_from overlap peaks","B_from overlap peaks","C_from overlap peaks"),
+col=c("green","red","blue","lightgreen","pink","lightblue","darkgreen","darkred","steelblue"),
+pch=c(20,20,20,20,20,20,20,20,20),bty="n")

> par()$oma
[1] 2 2 2 2
> par()$mar
[1] 5.1 4.1 4.1 8.0

当以长宽度(尝试 800,1000 像素)保存时,没有显示图例。但是当作为短宽度()时,部分图例显示。这真的让我很困惑。第一张图是 500*333,第二张图是 500*800。

enter image description here enter image description here

最佳答案

不确定如何将绘图保存到文件,但我通常的例行程序是通过通常的方式在 R 中制作一个漂亮的绘图:

plot(blah,blah,blah)
legend(blah,blah,blah)

然后一旦我对 R 控制台图形的外观感到满意,我就使用 pdf()或者它的表亲之一( jpeg()tiff() 等)将其保存到文件中,确保像这样设置宽度和高度参数:
# set up plotting device
pdf( {{FileName}},
width = par('din')[1],
height = par('din')[2])

plot(blah,blah,blah)
legend(blah,blah,blah)

# disconnect the plotting device
dev.off()

关于r - 保存到文件后,情节被切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29703276/

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