R:一个绘图窗口中的两个图形彼此相邻?

时间:2021-09-11 11:57:48

I'm struggling with this..I have one xts series with multiple columns, each column representing stock data. Now I want to draw one graph at the top of a plot window and another below this one (not in the scale as the other). However with plot() and then lines() doesn't work...

我正在努力解决这个问题。我有一个xts系列有多列,每列代表库存数据。现在我想在绘图窗口的顶部绘制一个图形,在另一个下面绘制另一个图形(不在另一个刻度中)。但是使用plot()然后lines()不起作用......

My code:

我的代码:

for(i in 1:nrow(BasketVariables)){
    plot(Basket[,2*i], main=colnames(Basket)[2*i])
    lines(Basket[,2*i+1], main=colnames(Basket)[2*i+1])
  }

1 个解决方案

#1


2  

I hope that this is what you need

我希望这就是你所需要的

par(mfrow=2:1)
plot(1:5,5:1)
plot(1:5,5:1)

#1


2  

I hope that this is what you need

我希望这就是你所需要的

par(mfrow=2:1)
plot(1:5,5:1)
plot(1:5,5:1)