简体   繁体   English

叶和茎图与布局不兼容 function

[英]leaf and stem diagram incompatible with the layout function

I am trying to join 4 graphs with the layout function. However, I only get 3 represented: all except the stem and leaf diagram.我正在尝试将布局为 function 的 4 个图表连接起来。但是,我只得到 3 个代表:除了茎叶图之外的所有图表。

In brief, this is what it looks like in r:简而言之,这就是 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?为什么干图 plot 与其他的不一样,还有另一个 function 可以做到吗?

Thank you in advance先感谢您

As @DaveArmstrong already hinted, stem outputs characters, which are printable but not plotable.正如@DaveArmstrong 已经暗示的那样, stem输出可打印但不可绘制的字符。

You could redirect the output from stem to a plot like so (shamelessly stolen from this SO answer ):您可以像这样将 output 从stem重定向到 plot(无耻地从这个 SO 答案中窃取):

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM