0

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

1 Answers1

0

If I understand your question correctly you want something like this: enter image description here

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)

Link

  1. using lattice

    library(lattice) barchart(Species~Reason,data=Reasonstats,groups=Catergory, scales=list(x=list(rot=90,cex=0.8)))

Link

Community
  • 1
  • 1
Ehsan
  • 4,334
  • 7
  • 39
  • 59