On Tue, 3 Jun 2008, Demetri S. Mouratis wrote:

Hi,

I'm trying to plot time-series data where each sample breaks down the percentage of CPU time spent in each of four states (usr, nice, sys, idle)


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
[on and on for many samples]

The plot I'm aiming for would stack the first three states in a colored barplot, so you get a visual sense of how busy the system is over the course of the day, and which state the CPU is spending its time in. (I've done this as area charts as well).

barplot() looked promising, but it wants to stack the columns instead of the rows.

Anybody have a good solution for this?

The "zoo" package provides a barplot() method for "zoo" series.

Example with some artificial data:

  library("zoo")
  x <- matrix(runif(44), ncol = 4)
  colnames(x) <- c("%usr", "%nice", "%sys", "%idle")
  z <- zoo(x, Sys.time() - c(10:0))
  barplot(z, legend = TRUE)

hth,
Z

Thanks!
...Demetri

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to