[R] Plotting a zoo object: lines and barplot

Gabor Grothendieck ggrothendieck at gmail.com
Mon Nov 28 14:07:11 CET 2011


In Mon, Nov 28, 2011 at 3:39 AM, Vikram Bahure
<economics.vikram at gmail.com> wrote:
> Dear R users,
>
> I have 3 columns in a zoo object. I want to plot all of them in one screen
> but I want the first two  to be in "lines" format and 3rd one to be
> barplot.
>

Try this:

library(zoo)

# create test data
set.seed(123)
z <- zoo(cbind(a = 1:10, b = 10:1, c = rnorm(10, 5, 3)))

plot(z, screen = 1, type = c("l", "l", "h"))


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list