I've just used r a little, so  this might be a trivial question but 

 

I have a small  data file

part,   vs/total         ,ps/total,    gpgpu,   date

...       ...               ...             ...           ..

 

that contains the percent that certain features contribute to a part and
the date the part was built 

 

 

I'd like to do stacked bar graphs one bar per part showing the percents 

and  I'd like tospace the bars based on the date released

 

I tried 

 

area <- read.csv("c:/talks/pact2008/g1.csv");

dates <-strptime(as.character(area$date), "%m/%d/%Y")

 

##  hack to figure out the amount to shift the bars 

l  <- length(as.POSIXct(dates))

diff <- as.numeric(difftime(dates[2:l], dates[1:(l-1)]))

diff <- rev(diff/max(diff))

 

colors <- gray.colors(3)

 

 

data <- c(area$ps.total[1:5], area$vs.total[1:5], area$gpgpu[1:5])

 

data <- 100*t(matrix(data, 5, 3))

 

## the .6 makes the bars look a little lighter, I did ths by eye

barplot(data,  space=diff+.6)

 

 

 

This works giving me the graph I want, but it seems so clunky, what is a
better way?

 

 

I do get a warning 

 

Warning messages:

1: In space + width :

  longer object length is not a multiple of shorter object length

2: In space + width :

  longer object length is not a multiple of shorter object length

> 

 

making me think I'm not understanding how space works.  I don't
understand how to set width, what kind of units would it be in?

 


        [[alternative HTML version deleted]]

______________________________________________
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