叶和茎图与布局功能不兼容

发布于 2025-01-18 01:12:22 字数 258 浏览 2 评论 0原文

我正在尝试使用布局功能连接 4 个图表。然而,我只得到了 3 个表示:除了茎叶图之外的所有图。

简而言之,这就是 r 中的样子:

layout(matrix(c(1,2,3,4), 2, 2, byrow =TRUE))
stem(graph1)
boxplot(graph2)
hist(graph3)
barplot(graph4)

为什么茎图的绘制与其他图不同,是否有另一个函数可以做到这一点?

先感谢您

I am trying to join 4 graphs with the layout function. However, I only get 3 represented: all except the stem and leaf diagram.

In brief, this is what it looks like in r:

layout(matrix(c(1,2,3,4), 2, 2, byrow =TRUE))
stem(graph1)
boxplot(graph2)
hist(graph3)
barplot(graph4)

Why doesn't the stem graph plot the same as the others, and is there another function that can do it?

Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少钕鈤記 2025-01-25 01:12:22

正如@davearmstrong已经暗示的那样,stem输出字符,这些字符可打印但不可绘制。

您可以将输出从stem重定向到类似的图(无耻地从 this So Anders ):

layout(matrix(c(1,2,3,4), 2, 2, byrow =TRUE))
## start stem-plot
plot.new()
tmp <- capture.output(stem(c(10,11,20:23)))
text( 0,1, paste(tmp, collapse='\n'), adj=c(0,1), family='mono' )
## end stem-plot
boxplot(runif(100))
hist(rnorm(100))
barplot(1:3)

As @DaveArmstrong already hinted, stem outputs characters, which are printable but not plotable.

You could redirect the output from stem to a plot like so (shamelessly stolen from this SO answer):

layout(matrix(c(1,2,3,4), 2, 2, byrow =TRUE))
## start stem-plot
plot.new()
tmp <- capture.output(stem(c(10,11,20:23)))
text( 0,1, paste(tmp, collapse='\n'), adj=c(0,1), family='mono' )
## end stem-plot
boxplot(runif(100))
hist(rnorm(100))
barplot(1:3)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文