How would it be possible to merge 2 histogram qplots and put them on the same plot instead of 2 separate plots? There is a similar question about simple 1D histograms: How to plot two histograms together in R? However, they don't use qplots and they use simple 1D histograms. Below is the original code. If you could modify it to have each of histogram legends to be one on left side and another one on the right side of the plot that would make my day. Thank you so much!!!
plt_d = d[s & grepl("Rd", d$Cmd), c("Time_Stamp_Norm",
"Virtual_Address_Norm")]
p1 <- qplot(Time_Stamp_Norm, Virtual_Address_Norm, data=plt_d,
geom='bin2d', binwidth = hist_binwidth,
xlab="Normalized Time",
ylab="Normalized Address",
main="Read requests in virtual address space") +
scale_fill_gradient(low="#C6DBEF", high="#08306B") +
xlim(0, 1+b_inv) + ylim(0, 1+b_inv) +
theme(axis.text=element_text(size=10), axis.title=element_text(size=10),
plot.title=element_text(size=10))
plt_d = d[s & grepl("Wr", d$Cmd), c("Time_Stamp_Norm",
"Virtual_Address_Norm")]
p2 <- qplot(Time_Stamp_Norm, Virtual_Address_Norm, data=plt_d,
geom='bin2d', binwidth = hist_binwidth,
xlab="Normalized Time",
ylab="Normalized Address",
main="Write requests in virtual address space") +
scale_fill_gradient(low="#C7E9C0", high="#00441B") +
xlim(0, 1+b_inv) + ylim(0, 1+b_inv) +
theme(axis.text=element_text(size=10), axis.title=element_text(size=10),
plot.title=element_text(size=10))
...
print(p1, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
print(p2, vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
...
dev.off()