Id like to make a grouped barplot that has two groups. One named Exotic Species and the second Native Species. then compare them to the Plot that they are found.Therefore 3 columns are involved with the graph. Y would be "Species Richness" and it would be the number of species either of native or exotic. X will be the "Plot name". How do i write out the coding for the bar graph i described above? If you google search European Parliament Elections R grouped barplot (orange and purply plot. thats what i want
Asked
Active
Viewed 497 times
0
-
Can you give a direct link to this Google search you mention? – howrad Nov 16 '14 at 07:01
-
This one? http://stackoverflow.com/questions/3007120/grouped-bar-graph – KFB Nov 16 '14 at 12:44
1 Answers
0
If I understand your question correctly you want something like this:
Here is two solutions:
1.using barplot: let's say mtcars is the dataframe
# Grouped Bar Plot
counts <- table(mtcars$vs, mtcars$gear)
barplot(counts, main="Car Distribution by Gears and VS",
xlab="Number of Gears", col=c("darkblue","red"),
legend = rownames(counts), beside=TRUE)
using lattice
library(lattice) barchart(Species~Reason,data=Reasonstats,groups=Catergory, scales=list(x=list(rot=90,cex=0.8)))