Re: [R] Removing inter-bar spaces in barchart
Oops, small typo, should be: barchart_test_heights=sin(c(1:100)) barchart_test_bins=c(c(1:50),c(1:50)) groups=c(rep(1,50),rep(2,50)) # Wish below didn't have spaces! barchart(barchart_test_bins~barchart_test_heights,groups=groups) On Wed, Aug 25, 2010 at 4:46 PM, Jonathan Greenberg greenb...@ucdavis.edu wrote: I apologize, let me add some data to play with: barchart_test_heights=sin(c(1:100)) barchart_test_bins=c(1:100) groups=c(rep(1,50),rep(2,50)) I have pre-calculated histogram data and the bins they belong to. I would like to plot the two histograms superimposed on one-another, having group 1 bars for a given bin be next to group 2 bars, something along the lines of: barchart(barchart_test_bins~barchart_test_heights,groups=groups) except with no space between the bars (and a key for the groups). --j P.S. And yes I was talking about barchart() from lattice -- however, I am happy to use another function if that makes this easier. On Wed, Aug 25, 2010 at 1:55 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 24, 2010, at 10:20 PM, Jonathan Greenberg wrote: Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! You didn't provide any data (nor did you illustrate with one of the available datasets that are used in examples.) Compare these two outputs: barchart(yield ~ year, data = barley, groups = variety, ylab = Barley Yield (bushels/acre), ) barchart(yield ~ variety, data = barley, groups = year, ylab = Barley Yield (bushels/acre), ) ... and notice that the variables in the group have no separation of their bars whereas the rhs variables do. This is the opposite of what I expected, so perhaps you think as I did and reversing the roles ofy and z might help? -- David Winsemius, MD West Hartford, CT -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department of Land, Air and Water Resources University of California, Davis One Shields Avenue Davis, CA 95616 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department of Land, Air and Water Resources University of California, Davis One Shields Avenue Davis, CA 95616 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 __ 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.
Re: [R] Removing inter-bar spaces in barchart
I apologize, let me add some data to play with: barchart_test_heights=sin(c(1:100)) barchart_test_bins=c(1:100) groups=c(rep(1,50),rep(2,50)) I have pre-calculated histogram data and the bins they belong to. I would like to plot the two histograms superimposed on one-another, having group 1 bars for a given bin be next to group 2 bars, something along the lines of: barchart(barchart_test_bins~barchart_test_heights,groups=groups) except with no space between the bars (and a key for the groups). --j P.S. And yes I was talking about barchart() from lattice -- however, I am happy to use another function if that makes this easier. On Wed, Aug 25, 2010 at 1:55 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 24, 2010, at 10:20 PM, Jonathan Greenberg wrote: Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! You didn't provide any data (nor did you illustrate with one of the available datasets that are used in examples.) Compare these two outputs: barchart(yield ~ year, data = barley, groups = variety, ylab = Barley Yield (bushels/acre), ) barchart(yield ~ variety, data = barley, groups = year, ylab = Barley Yield (bushels/acre), ) ... and notice that the variables in the group have no separation of their bars whereas the rhs variables do. This is the opposite of what I expected, so perhaps you think as I did and reversing the roles ofy and z might help? -- David Winsemius, MD West Hartford, CT -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department of Land, Air and Water Resources University of California, Davis One Shields Avenue Davis, CA 95616 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 __ 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.
Re: [R] Removing inter-bar spaces in barchart
On Thu, Aug 26, 2010 at 5:22 AM, Jonathan Greenberg greenb...@ucdavis.edu wrote: Oops, small typo, should be: barchart_test_heights=sin(c(1:100)) barchart_test_bins=c(c(1:50),c(1:50)) groups=c(rep(1,50),rep(2,50)) # Wish below didn't have spaces! barchart(barchart_test_bins~barchart_test_heights,groups=groups) barchart(barchart_test_bins~barchart_test_heights,groups=groups, box.width = 1) (see ?panel.barchart.) -Deepayan __ 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.
Re: [R] Removing inter-bar spaces in barchart
On 08/26/2010 06:36 AM, Dennis Murphy wrote: ... It looks like he's using barchart() in lattice, which does have a box.ratio argument. That's why I didn't suggest using barp with width=0.5 Jim __ 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] Removing inter-bar spaces in barchart
Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department of Land, Air and Water Resources University of California, Davis One Shields Avenue Davis, CA 95616 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 __ 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.
Re: [R] Removing inter-bar spaces in barchart
Using the barplot function in base graphics you just set space=0, but that function does not have a box.ratio argument which would imply that you are using something else. If you let us know which function (and which package it is in) then it is easier (possible) for us to help you, even better is to give the information asked for at the bottom of every post and the posting guide. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Jonathan Greenberg Sent: Tuesday, August 24, 2010 8:21 PM To: r-help Subject: [R] Removing inter-bar spaces in barchart Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department of Land, Air and Water Resources University of California, Davis One Shields Avenue Davis, CA 95616 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 __ 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.
Re: [R] Removing inter-bar spaces in barchart
Hi: On Wed, Aug 25, 2010 at 11:28 AM, Greg Snow greg.s...@imail.org wrote: Using the barplot function in base graphics you just set space=0, but that function does not have a box.ratio argument which would imply that you are using something else. If you let us know which function (and which package it is in) then it is easier (possible) for us to help you, even better is to give the information asked for at the bottom of every post and the posting guide. It looks like he's using barchart() in lattice, which does have a box.ratio argument. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Jonathan Greenberg Sent: Tuesday, August 24, 2010 8:21 PM To: r-help Subject: [R] Removing inter-bar spaces in barchart Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! I'm more interested in why you'd 'ideally want zero space between the bars'. By default, bar chart functions in R have spaces between bars because the bars represent different categories of a discrete/factor variable and the space is a visual device meant to connote to the viewer that the categories are not to be interpreted as an underlying continuum. In contrast, there are no spaces in between bars of a histogram precisely because the x-scale is meant to be continuous. Since you're using barchart(), why do you want to remove the space between bars? Cheers, Dennis --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial Technologies and Remote Sensing (CSTARS) Department of Land, Air and Water Resources University of California, Davis One Shields Avenue Davis, CA 95616 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 __ 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. [[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.
Re: [R] Removing inter-bar spaces in barchart
On Aug 24, 2010, at 10:20 PM, Jonathan Greenberg wrote: Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 1 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! You didn't provide any data (nor did you illustrate with one of the available datasets that are used in examples.) Compare these two outputs: barchart(yield ~ year, data = barley, groups = variety, ylab = Barley Yield (bushels/acre), ) barchart(yield ~ variety, data = barley, groups = year, ylab = Barley Yield (bushels/acre), ) ... and notice that the variables in the group have no separation of their bars whereas the rhs variables do. This is the opposite of what I expected, so perhaps you think as I did and reversing the roles ofy and z might help? -- David Winsemius, MD West Hartford, CT __ 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.