Hi - I would like to make to make a barplot of my data, but am having issues. An example of my data is: species net pair pounds type Cod Control 1 46 kept Little Skate Control 1 0 kept Summer Flounder Control 1 9 kept Windowpane Flounder Control 1 0 kept Winter Flounder Control 1 0 kept Winter Skate Control 1 0 kept Yellowtail Flounder Control 1 76 kept Cod Experimental 1 19 kept Little Skate Experimental 1 0 kept Summer Flounder Experimental 1 2 kept Windowpane Flounder Experimental 1 0 kept Winter Flounder Experimental 1 0 kept Winter Skate Experimental 1 0 kept Yellowtail Flounder Experimental 1 9 kept Cod Control 1 14 discard Little Skate Control 1 75 discard Summer Flounder Control 1 1 discard Windowpane Flounder Control 1 32 discard Winter Flounder Control 1 16 discard Winter Skate Control 1 225 discard Yellowtail Flounder Control 1 7 discard Cod Experimental 1 7 discard Little Skate Experimental 1 64 discard Summer Flounder Experimental 1 3 discard Windowpane Flounder Experimental 1 26 discard Winter Flounder Experimental 1 12 discard Winter Skate Experimental 1 136 discard Yellowtail Flounder Experimental 1 5 discard I have 9 total pairs. I would like to be able be able to make a barplot by pair that shows the catch of the control net (kept & discard) stacked with the catch of the experimental net also stacked by species like the image below I did in excel. http://r.789695.n4.nabble.com/file/n3670861/image.jpg I can make barplots by net and pair, but I would like to have both nets on one barplot if possible. Thanks Sally -- View this message in context: http://r.789695.n4.nabble.com/barplot-question-tp3670861p3670861.html Sent from the R help mailing list archive at Nabble.com.
Start out with ?barplot Then please tell us what your "issues" are. The barplot function is pretty flexible. If I guess that you are having difficulty simultaneously plotting one set of stacked bars and another set of non-stacked bars next to them, I would recommend two approaches. One is to play with > barplot(first_stuff) > par(new=TRUE) > barplot(second_stuff) The other, and probably better, approach, is to write your data of interest into a new matrix with some zeroes added to certain columns, and use the "beside=FALSE" argument to barplot(). Carl Sally Roman wrote: Hi - I would like to make to make a barplot of my data, but am having issues. An example of my data is: species net pair pounds type Cod Control 1 46 kept Little Skate Control 1 0 kept Summer Flounder Control 1 9 kept Windowpane Flounder Control 1 0 kept Winter Flounder Control 1 0 kept Winter Skate Control 1 0 kept Yellowtail Flounder Control 1 76 kept Cod Experimental 1 19 kept Little Skate Experimental 1 0 kept Summer Flounder Experimental 1 2 kept Windowpane Flounder Experimental 1 0 kept Winter Flounder Experimental 1 0 kept Winter Skate Experimental 1 0 kept Yellowtail Flounder Experimental 1 9 kept Cod Control 1 14 discard Little Skate Control 1 75 discard Summer Flounder Control 1 1 discard Windowpane Flounder Control 1 32 discard Winter Flounder Control 1 16 discard Winter Skate Control 1 225 discard Yellowtail Flounder Control 1 7 discard Cod Experimental 1 7 discard Little Skate Experimental 1 64 discard Summer Flounder Experimental 1 3 discard Windowpane Flounder Experimental 1 26 discard Winter Flounder Experimental 1 12 discard Winter Skate Experimental 1 136 discard Yellowtail Flounder Experimental 1 5 discard I have 9 total pairs. I would like to be able be able to make a barplot by pair that shows the catch of the control net (kept & discard) stacked with the catch of the experimental net also stacked by species like the image below I did in excel. http://r.789695.n4.nabble.com/file/n3670861/image.jpg I can make barplots by net and pair, but I would like to have both nets on one barplot if possible. -- ----- Sent from my Cray XK6
I have done ?barplot. I have not problems making barplots in R except for this where there are actually two stacked columns for each fish. I have also searched the internet to look for examples like what I would like to plot, but have not found any which is why I thought putting a post would be helpful. -- View this message in context: http://r.789695.n4.nabble.com/barplot-question-tp3670861p3675588.html Sent from the R help mailing list archive at Nabble.com.
As Sarah requested, could you at least read the posting guide and provide us with some sample data? ------------------------------------------ Robert W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A. T. Still University of Health Sciences 800 W. Jefferson St. Kirksville, MO 63501 660-626-2322 FAX 660-626-2965 -----Original Message----- From: Sally_roman Sent: Monday, July 18, 2011 12:15 PM To: r-help at r-project.org Subject: Re: [R] barplot question I would like to make stacked barplots, but with two stacked columns per x value. For cod - I have kept and discard values for 2 nets. I would like to have one stacked column for the control net with the kept and discard value and then another column with the kept and discard values for the experimental net. I can make a stacked barplots in R that will plot one net by species, but my boss would like to have both nets on the same graph. I have done it in excel, but was hoping to do the same thing in R. All of the R barplots I have found including the ones that you included as links do not demonstrate what I would like to do. Is is possible in R? -- View this message in context: http://r.789695.n4.nabble.com/barplot-question-tp3670861p3675912.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.