0

I have data in a zoo object which has multiple columns. Now I want to plot (four of those columns) two columns in same and two in graph below the previous graph.

To be more precise, I have been able to plot the four of them one below the other. But I want first two in the same plot and last two in the next plot

enter image description here

shoonya
  • 292
  • 1
  • 10
  • 3
    Use the `screens=` argument of `plot.zoo`. In the examples section at the bottom of `?plot.zoo` the last example in the multivariate plotting section puts two of the three plots in one panel. – G. Grothendieck Jun 25 '12 at 14:31
  • 1
    I'm a bit late to the party, but I might also suggest you take a look at the (new) plot.xts method in my xtsExtra package, available off R-Forge. It's a major revamp of plot.xts and is part of some GSOC work. Given your axis labels, I'd guess you're in HFT and as Brian Peterson has said on R-SIG-Finance before: "if you're doing finance and you're not using xts, you're doing it wrong." Since xts inherits from zoo, the syntax is rather similar, something like plot(dat, screens = c(1,1,2,2), layout = matrix(1:2, ncol = 1)) but you get nice formatting (as well as cool customizability). – mweylandt Jul 04 '12 at 23:09
  • Following on myself since I was about to hit the character limit: Note that it's all highly experimental code and likely to change. I know most FOSS comes with NO WARRANTY, [to quote R's ominous startup banner] but this is double-super NO WARRANTY. – mweylandt Jul 04 '12 at 23:11
  • Thanks a lot. xts and zoo seem like the way to go. Amazing visualizations. – shoonya Jul 06 '12 at 04:49

1 Answers1

1

It should work by adding nc=2 in your plot command (ie number of columns = 2).

Taryn
  • 242,637
  • 56
  • 362
  • 405