I am trying to change the bar width of my plots, my codes are here:
ggplot(df_densityWindow, aes(x = idx, y = density, color = factor(location))) +
geom_bar(stat = 'identity', fill = 'white', width = 1) +
theme_bw() +
facet_grid(marker ~ case, scales = 'free') +
theme(strip.background = element_rect(colour="black", fill="white"),
strip.text = element_text(margin = margin(10, 10, 10, 10), size = 40)) +
scale_color_manual(name = 'Regions',values = c("#F26969", "#02f527",'#F2F2C6')) +
background_grid(major = 'y', minor = "none") + # add thin horizontal lines
xlab('Index') +
ylab(expression(paste('Density/', mm^2, )))+
theme(axis.text = element_text(size = 38)) +
theme(axis.title = element_text(size = 40)) +
theme(legend.text = element_text(size = 38)) +
theme(legend.title = element_text(size = 40)) +
theme(axis.text.x=element_text(angle=90, hjust=1)) +
panel_border()
Since I changed the bar width to 1, I assume there should not be any overlapping between each bar, however, the results are:
For a closer look:
They are still overlapping with each other, how to solve this?