Good Afternoon, I'm trying to create a graph that displays the best way the following information. ??? For instance organized by bar graph, A, B, C Source X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s 1 A 47 63 75 116 125 129 131 131 131 131 2 B 37 64 45 11 25 19 61 131 186 186 3 C 17 62 25 66 12 29 91 171 186 186 thanks -- View this message in context: http://r.789695.n4.nabble.com/graph-displays-tp4634448.html Sent from the R help mailing list archive at Nabble.com.
There's no way we can tell you the "best way" to display your information, because we don't know anything about it. The best display method has a lot to do with what the data are, and what you're trying to illustrate. That said, here are two possibilities, one using the bar graph you requested, and both using only base graphics. # PLEASE use dput() to provide your data, rather than pasting it in testdata <- structure(list(Source = c("A", "B", "C"), X1000s = c(47L, 37L, 17L), X600s = c(63L, 64L, 62L), X500s = c(75L, 45L, 25L), X250s = c(116L, 11L, 66L), X100s = c(125L, 25L, 12L), X50s = c(129L, 19L, 29L ), X10s = c(131L, 61L, 91L), X5s = c(131L, 131L, 171L), X3s = c(131L, 186L, 186L), X1s = c(131L, 186L, 186L)), .Names = c("Source", "X1000s", "X600s", "X500s", "X250s", "X100s", "X50s", "X10s", "X5s", "X3s", "X1s"), class = "data.frame", row.names = c("1", "2", "3")) barplot(as.matrix(testdata[,-1]), beside=TRUE, col=1:3) legend("topleft", LETTERS[1:3], col=1:3, pch=15) plot(1:10, testdata[1, -1], type="b", ylim=c(0, 200), xaxt="n", col=1) axis(1, 1:10, colnames(testdata)[-1]) lines(1:10, testdata[2, -1], type="b", col=2) lines(1:10, testdata[3, -1], type="b", col=3) legend("topleft", LETTERS[1:3], col=1:3, pch=15) Sarah On Mon, Jun 25, 2012 at 12:24 PM, MSousa <ricardosousa2000 at clix.pt> wrote:> > Good Afternoon, I'm trying to create a graph that displays the best way the > following information. > > ??? For instance organized by bar graph, A, B, C > > > > Source X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s > 1 ? ? ?A ? ? 47 ? ?63 ? ?75 ? 116 ? 125 ?129 ?131 131 131 131 > 2 ? ? ?B ? ? 37 ? ?64 ? ?45 ? ?11 ? ?25 ? 19 ? 61 131 186 186 > 3 ? ? ?C ? ? 17 ? ?62 ? ?25 ? ?66 ? ?12 ? 29 ? 91 171 186 186 > > thanks > >-- Sarah Goslee http://www.functionaldiversity.org
xx <- structure(list(X1000s = c(47L, 37L, 17L), X600s = c(63L, 64L, 62L), X500s = c(75L, 45L, 25L), X250s = c(116L, 11L, 66L), X100s = c(125L, 25L, 12L), X50s = c(129L, 19L, 29L), X10s = c(131L, 61L, 91L), X5s = c(131L, 131L, 171L), X3s = c(131L, 186L, 186L), X1s = c(131L, 186L, 186L)), .Names = c("X1000s", "X600s", "X500s", "X250s", "X100s", "X50s", "X10s", "X5s", "X3s", "X1s"), class = "data.frame", row.names = c("A", "B", "C")) #then this should do barplot(t(xx)) John Kane Kingston ON Canada> -----Original Message----- > From: ricardosousa2000 at clix.pt > Sent: Mon, 25 Jun 2012 09:24:36 -0700 (PDT) > To: r-help at r-project.org > Subject: [R] graph displays > > > Good Afternoon, I'm trying to create a graph that displays the best way > the > following information. > > ??? For instance organized by bar graph, A, B, C > > > > Source X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s > 1 A 47 63 75 116 125 129 131 131 131 131 > 2 B 37 64 45 11 25 19 61 131 186 186 > 3 C 17 62 25 66 12 29 91 171 186 186 > > thanks > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/graph-displays-tp4634448.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.____________________________________________________________ GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails
Good morning, Thanks for help. I can explain better what I am trying to do. I'm trying to read data from a file, separated by a tab, with the following code. Dataset<-read.table("C:/Users/Administrator/Desktop/R/graph.txt",sep="\t", quote="\"",header = TRUE) View(Dataset) dput(Dataset)> View(Dataset) > dput(Dataset)structure(list(Source = structure(1:3, .Label = c("A", "B", "C" ), class = "factor"), X1000s = c(47L, 37L, 17L), X600s = c(63L, 64L, 62L), X500s = c(75L, 45L, 25L), X250s = c(116L, 11L, 66L ), X100s = c(125L, 25L, 12L), X50s = c(129L, 19L, 29L), X10s = c(131L, 61L, 91L), X5s = c(131L, 131L, 171L), X3s = c(131L, 186L, 186L ), X1s = c(131L, 186L, 186L)), .Names = c("Source", "X1000s", "X600s", "X500s", "X250s", "X100s", "X50s", "X10s", "X5s", "X3s", "X1s"), class = "data.frame", row.names = c(NA, -3L))> DatasetSource X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s 1 A 47 63 75 116 125 129 131 131 131 131 2 B 37 64 45 11 25 19 61 131 186 186 3 C 17 62 25 66 12 29 91 171 186 186 the idea is to get a graph like this excel, but in R, as I'm still in the learning phase of the R, I have little knowledge how to do http://imageshack.us/photo/my-images/51/testlt.png/ -- View this message in context: http://r.789695.n4.nabble.com/graph-displays-tp4634448p4634488.html Sent from the R help mailing list archive at Nabble.com.
Sorry I misunderstood what you wanted. Using ggplot2 and reshape2 which I imagine you will have to install, this should give you what you want library(ggplot2) library(reshape2) xx1 <- melt(Dataset, id = c("Source")) p <- ggplot( xx1 , aes(variable, value, fill= Source )) + geom_bar(position = "dodge") + scale_y_continuous(" Scale Values") + scale_x_discrete("X values") + opts( title = "Graphing Exercise") p John Kane Kingston ON Canada> -----Original Message----- > From: ricardosousa2000 at clix.pt > Sent: Tue, 26 Jun 2012 01:24:17 -0700 (PDT) > To: r-help at r-project.org > Subject: Re: [R] graph displays > > > > Good morning, > Thanks for help. > I can explain better what I am trying to do. > I'm trying to read data from a file, separated by a tab, with the > following > code. > > > Dataset<-read.table("C:/Users/Administrator/Desktop/R/graph.txt",sep="\t", > quote="\"",header = TRUE) > View(Dataset) > dput(Dataset) > >> View(Dataset) >> dput(Dataset) > structure(list(Source = structure(1:3, .Label = c("A", "B", "C" > ), class = "factor"), X1000s = c(47L, 37L, 17L), X600s = c(63L, > 64L, 62L), X500s = c(75L, 45L, 25L), X250s = c(116L, 11L, 66L > ), X100s = c(125L, 25L, 12L), X50s = c(129L, 19L, 29L), X10s = c(131L, > 61L, 91L), X5s = c(131L, 131L, 171L), X3s = c(131L, 186L, 186L > ), X1s = c(131L, 186L, 186L)), .Names = c("Source", "X1000s", > "X600s", "X500s", "X250s", "X100s", "X50s", "X10s", "X5s", "X3s", > "X1s"), class = "data.frame", row.names = c(NA, -3L)) >> Dataset > Source X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s > 1 A 47 63 75 116 125 129 131 131 131 131 > 2 B 37 64 45 11 25 19 61 131 186 186 > 3 C 17 62 25 66 12 29 91 171 186 186 > > > the idea is to get a graph like this excel, but in R, > as I'm still in the learning phase of the R, I have little knowledge how > to > do > > http://imageshack.us/photo/my-images/51/testlt.png/ > > -- > View this message in context: > http://r.789695.n4.nabble.com/graph-displays-tp4634448p4634488.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.____________________________________________________________ Receive Notifications of Incoming Messages Easily monitor multiple email accounts & access them with a click. Visit http://www.inbox.com/notifier and check it out!