Dear useRs, I can't seem to find out how to categorize my histogram. I have the following dataset: Time??????????? First.day? Second.day 08:00-10:00??????? 9?????????? ? 8 10:00-12:00?????? 13???????? ? 15 12:00-14:00??????? 9?????????? ? 9 14:00-16:00???????10????????? ? 9 I attached a jpeg file to this e-mail containing the sketches. What I'd like to do is a barplot (or histogram), firstly?with 2 categories - first and second day (figure 1) And then with 4 categories - the times (figure 2) Also, I'd like the graphs both with lines (as sketched) and bars. Thanks in advance, Kind regards, Rafael. ____________________________________________________________________________________ Veja quais s?o os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com
Sorry for the double post, I couldn't attach the image in the previous one, so I uploaded it to imageshack, the link is http://img32.imageshack.us/img32/2042/imageyvh.jpg Thanks! Dear useRs, I can't seem to find out how to categorize my histogram. I have the following dataset: Time First.day Second.day 08:00-10:00 9 8 10:00-12:00 13 15 12:00-14:00 9 9 14:00-16:00 10 9 I attached a jpeg file to this e-mail containing the sketches. What I'd like to do is a barplot (or histogram), firstly with 2 categories - first and second day (figure 1) And then with 4 categories - the times (figure 2) Also, I'd like the graphs both with lines (as sketched) and bars. Thanks in advance, Kind regards, Rafael. ____________________________________________________________________________________ [[elided Yahoo spam]] [[alternative HTML version deleted]]
I think you want a barplot. I don't see what a histogram will add. Your attachement seems to have been lost so I am just guessing what you might want but, assuming you have a data.frame try barplot(as.matrix(xx[,2:3]), beside = TRUE) dd <- t(as.matrix(xx[,2:3])) colnames(dd) <- xx[,1] barplot(dd, beside=TRUE) Have a look at arguments such as density and color in ?barplot for lines etc. --- On Thu, 8/20/09, Rafael Moral <rafa_moral2004 at yahoo.com.br> wrote:> From: Rafael Moral <rafa_moral2004 at yahoo.com.br> > Subject: [R] categorized barplot > To: "r-help" <r-help at r-project.org> > Received: Thursday, August 20, 2009, 2:29 PM > Dear useRs, > > I can't seem to find out how to categorize my histogram. > > I have the following dataset: > > Time??????????? First.day? Second.day > 08:00-10:00??????? 9?????????? ? 8 > 10:00-12:00?????? 13???????? ? 15 > 12:00-14:00??????? 9?????????? ? 9 > 14:00-16:00???????10????????? ? 9 > > I attached a jpeg file to this e-mail containing the > sketches. > What I'd like to do is a barplot (or histogram), > firstly?with 2 categories - first and second day (figure > 1) > And then with 4 categories - the times (figure 2) > Also, I'd like the graphs both with lines (as sketched) and > bars. > > Thanks in advance, > Kind regards, > > Rafael. > > > ? ? ? > ____________________________________________________________________________________ > Veja quais s?o os assuntos do momento no Yahoo! +Buscados > http://br.maisbuscados.yahoo.com > -----Inline Attachment Follows----- > > ______________________________________________ > R-help at 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. >__________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/
Rafael Moral wrote:> Dear useRs, > > I can't seem to find out how to categorize my histogram. > > I have the following dataset: > > Time First.day Second.day > 08:00-10:00 9 8 > 10:00-12:00 13 15 > 12:00-14:00 9 9 > 14:00-16:00 10 9 > > I attached a jpeg file to this e-mail containing the sketches. > What I'd like to do is a barplot (or histogram), firstly with 2 categories - first and second day (figure 1) > And then with 4 categories - the times (figure 2) > Also, I'd like the graphs both with lines (as sketched) and bars. > >Hi Rafael, The hierobarp function in the plotrix package does something like this, overlaying successively finer breakdowns. I am currently writing more variants of this function and one that displayed a multiway array would be quite useful. If you think that a variant of hierobarp would suit your needs, let me know. Jim