gpt4 book ai didi

中心的 R 条形图图例

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

我有一个条形图,看起来像这样: enter image description here

我想在粗体矩形的某个地方添加一个图例,我已经尝试过 par(xpd=TRUE) 并为第四个条形图设置边距但由于某些原因我无法让它工作......

所以,如果您有任何想法,请告诉我!

最佳答案

不确定为什么 xpd 不适合你,但下面的一段代码应该会给你一些线索:

par(mfrow=c(2,2), xpd=TRUE)
barplot(tN, col = 2:3)
barplot(tN, col = 2:3)
barplot(tN, col = 2:3)
barplot(tN, col = 2:3)
legend(-4.5, 56, c("A", "B"), col=2:3,lwd=1)

为了了解图例的坐标,我使用了 locator() 函数。

关于中心的 R 条形图图例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15510228/

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