Hello , I am trying to create a histogram in order to compare between two groups and would like it to be similar to the figure attached. How can I generate this using R ? Thank you, Nandini http://r.789695.n4.nabble.com/file/n3582448/5634-15977-1-PB.gif -- View this message in context: http://r.789695.n4.nabble.com/Histogram-tp3582448p3582448.html Sent from the R help mailing list archive at Nabble.com.
Histogram
8 messages · Steven Kennedy, nandini_bn, Rolf Turner +2 more
Have a look at: http://addictedtor.free.fr/graphiques/thumbs.php One of the graph examples they have is exactly what you are after.
On Wed, Jun 8, 2011 at 11:14 PM, nandini_bn <nandini_bn at hotmail.com> wrote:
Hello , I am trying to create a histogram in order to compare between two groups and would like it to be similar to the figure attached. How can I generate this using R ? Thank you, Nandini http://r.789695.n4.nabble.com/file/n3582448/5634-15977-1-PB.gif -- View this message in context: http://r.789695.n4.nabble.com/Histogram-tp3582448p3582448.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.
I think the command you want is barplot x = rbinom(10,15,0.65) y = rbinom(10,15,0.25) barplot(rbind(x,y),beside=TRUE) Sam
On Wed, Jun 8, 2011 at 10:14 AM, nandini_bn <nandini_bn at hotmail.com> wrote:
Hello , I am trying to create a histogram in order to compare between two groups and would like it to be similar to the figure attached. How can I generate this using R ? Thank you, Nandini http://r.789695.n4.nabble.com/file/n3582448/5634-15977-1-PB.gif -- View this message in context: http://r.789695.n4.nabble.com/Histogram-tp3582448p3582448.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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110608/e7ff67c4/attachment.pl>
On 09/06/11 16:39, nandini_bn wrote:
Hi Sam,This is exactly what I wanted. Could you please explain the code ? what does 15, 0.65 and 0.25 stand for ?Nandini Date: Wed, 8 Jun 2011 15:16:45 -0700 From: ml-node+3583766-897200094-233845 at n4.nabble.com To: nandini_bn at hotmail.com Subject: Re: Histogram I think the command you want is barplot x = rbinom(10,15,0.65) y = rbinom(10,15,0.25) barplot(rbind(x,y),beside=TRUE)
RTFM. I.e. execute
?rbinom
cheers,
Rolf Turner
Nice graphs there. Thanks. I too am looking to make a similar plot, with a difference: I need only the top parts of the many 'histograms' (a step-function like plot for histogram/bar-plots). I already have values for "heights" of bars for x1-x2 intervals computed from a large survey data; I want steps to be left-continuous; and step-functions to be plotted with different lines and symbols for each of many groups. I also want to make similar plots for cumulative 'histograms/bar-plots' to compare groups. I have "cumulative heights" for x1-x2 intervals, left-continuous. Any idea how to do this? -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Steven Kennedy Sent: Thursday, June 09, 2011 3:28 AM To: nandini_bn Cc: r-help at r-project.org Subject: Re: [R] Histogram Have a look at: http://addictedtor.free.fr/graphiques/thumbs.php One of the graph examples they have is exactly what you are after.
On Wed, Jun 8, 2011 at 11:14 PM, nandini_bn <nandini_bn at hotmail.com> wrote:
Hello , I am trying to create a histogram in order to compare between two groups and would like it to be similar to the figure attached. How can I generate this using R ? Thank you, Nandini http://r.789695.n4.nabble.com/file/n3582448/5634-15977-1-PB.gif -- View this message in context: http://r.789695.n4.nabble.com/Histogram-tp3582448p3582448.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.
______________________________________________ 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.
It's difficult to understand what exactly you're looking for without seeing an example, could you post a simple version? imgur.com is a website that lets you quickly upload pictures to share with others. I think your problem can be solved with the type='s' option to the general plot routine. Consider the following three plots, I think the third is the one you're looking for. x = runif(10,0,1) x2 = cumsum(x) plot(x2) plot(x2,type='l') plot(x2,type='s') Hope that helps, Sam Stewart
On Thu, Jun 9, 2011 at 9:15 AM, Anupam <anupamtg at gmail.com> wrote:
Nice graphs there. Thanks. I too am looking to make a similar plot, with a difference: I need only the top parts of the many 'histograms' (a step-function like plot for histogram/bar-plots). I already have values for "heights" of bars for x1-x2 intervals computed from a large survey data; I want steps to be left-continuous; and step-functions to be plotted with different lines and symbols for each of many groups. I also want to make similar plots for cumulative 'histograms/bar-plots' to compare groups. I have "cumulative heights" for x1-x2 intervals, left-continuous. Any idea how to do this? -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Steven Kennedy Sent: Thursday, June 09, 2011 3:28 AM To: nandini_bn Cc: r-help at r-project.org Subject: Re: [R] Histogram Have a look at: http://addictedtor.free.fr/graphiques/thumbs.php One of the graph examples they have is exactly what you are after. On Wed, Jun 8, 2011 at 11:14 PM, nandini_bn <nandini_bn at hotmail.com> wrote:
Hello , I am trying to create a histogram in order to compare between two groups and would like it to be similar to the figure attached. How can I generate this using R ? Thank you, Nandini http://r.789695.n4.nabble.com/file/n3582448/5634-15977-1-PB.gif -- View this message in context: http://r.789695.n4.nabble.com/Histogram-tp3582448p3582448.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.
______________________________________________ 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. ______________________________________________ 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.
Thanks. That is the type of graph I want, except with more options and combinations. Here is an example with percent on Y-axis: http://i.imgur.com/pr8M3.jpg This combines both 'histogram' and 'cumulative histogram' type of data. In place of straight lines connecting the points I want step-functions. I already have heights (y) and end points of x intervals in a file (except for the last, x1-x2, where I only have x1). The points are heights, left-continuous (they are at the end of the x1-x2 interval, and do not include x2). -----Original Message----- From: R Help [mailto:rhelp.stats at gmail.com] Sent: Thursday, June 09, 2011 5:58 PM To: Anupam Cc: Steven Kennedy; r-help at r-project.org Subject: Re: [R] Histogram It's difficult to understand what exactly you're looking for without seeing an example, could you post a simple version? imgur.com is a website that lets you quickly upload pictures to share with others. I think your problem can be solved with the type='s' option to the general plot routine. Consider the following three plots, I think the third is the one you're looking for. x = runif(10,0,1) x2 = cumsum(x) plot(x2) plot(x2,type='l') plot(x2,type='s') Hope that helps, Sam Stewart
On Thu, Jun 9, 2011 at 9:15 AM, Anupam <anupamtg at gmail.com> wrote:
Nice graphs there. Thanks. I too am looking to make a similar plot, with a difference: I need only the top parts of the many 'histograms' (a step-function like plot for histogram/bar-plots). I already have values for "heights" of bars for x1-x2 intervals computed from a large survey data; I want steps to be left-continuous; and step-functions to be plotted with different lines and symbols for each of many groups. I also want to make similar plots for cumulative 'histograms/bar-plots' to compare groups. I have "cumulative heights" for x1-x2 intervals, left-continuous. Any idea how to do this? -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Steven Kennedy Sent: Thursday, June 09, 2011 3:28 AM To: nandini_bn Cc: r-help at r-project.org Subject: Re: [R] Histogram Have a look at: http://addictedtor.free.fr/graphiques/thumbs.php One of the graph examples they have is exactly what you are after. On Wed, Jun 8, 2011 at 11:14 PM, nandini_bn <nandini_bn at hotmail.com>
wrote:
Hello , I am trying to create a histogram in order to compare between two groups and would like it to be similar to the figure attached. How can I generate this using R ? Thank you, Nandini http://r.789695.n4.nabble.com/file/n3582448/5634-15977-1-PB.gif -- View this message in context: http://r.789695.n4.nabble.com/Histogram-tp3582448p3582448.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.
______________________________________________ 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. ______________________________________________ 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.