I am super new to R
coding and I'm trying to create some simple bar graphs for a presentation. I took two data sets and overlapped them using par(new=TRUE)
but for some reason, the bars that I want to overlap are just slightly underneath the bars I want under. I have no idea how to fix this.
BG_all
is my dataset
, count
and disease
are my 2 variables that I want to overlap
Here is my code:
barplot(BG_all$Count,names.arg=1:12,xlab='Month',ylab='Total Catch',col = "skyblue3")
par(new=TRUE)
barplot(BG_all$Disease,ylim=c(0,1000),axes=FALSE,col="grey0")
title(main="Black Gill Disease in White Shrimp Trawl Survey Catch")
If you look at the link at the bottom of my post, you'll see what I'm talking about...the Disease variable bars are slightly below the blue Count variable bars.
Any idea of how to solve this problem or find an easier way to make this sort of plot? I've tried using ggplot
based off of a tutorial and I've gotten error message after error message, so I thought laying one on top of another would be helpful