Skip to content
Prev 146029 / 398500 Next

Stacked barplot of timeseries data

Here is a variation of the example below which uses
your data. Paste this into an R session:


Lines <- "19:08:15  %usr  %nice   %sys   %idle
19:08:16    5      0     10     86
19:08:17   17      0     14     69
19:08:18    5      0      8     87
19:08:19   10      0     10     81
19:08:20    3      0      7     90
19:08:21    4      0      8     88
"
library(zoo)
library(chron)

# in reality the commented line next replaces the one after it
# z <- read.csv("myfile.dat", header = TRUE, FUN = times)
z <- read.zoo(textConnection(Lines), header = TRUE, FUN = times)
colnames(z) <- sub("X.", "% ", colnames(z))

barplot(z[, 1:3], legend = TRUE, col = 1:3)


On Tue, Jun 3, 2008 at 7:47 PM, Achim Zeileis
<Achim.Zeileis at wu-wien.ac.at> wrote: