What I am trying to do is create a "dodged" bar chart using gglot from two different dataframes
Unfortunately geom_bar
doesn't see the previous data added so it plots it right over top, I've tried playing with position and width but it doesn't seem to change anything probably due to the fact that it is one bar per category.
The code below creates the data plots the data incorrectly (bars are on top of one another) and then plots it correctly using a workaround of binding the dataframes together.
library("ggplot2") x<-data.frame(dat=rep(seq(1,4),3),let=rep("X")) y<-data.frame(dat=rep(seq(1,4),4),let=rep("y")) xy<-rbind(x,y) #what I would like to use with two different data frames ggplot(NULL,aes(dat))+ geom_bar(data=y,fill="red",width=0.1,position = "dodge")+ geom_bar(data=x,fill="blue",width=0.1,position = "dodge") #what I would like to see only without binding dfs ggplot(xy,aes(dat,fill=let))+geom_bar(position="dodge")
I'm using ggplot to be constant with other plots that use only a single dataframe.