Bar graphs can be used to visualise the relationship between a quantitative variable (the dependent variable) and different categories (the independent variable). Bar graphs show categorical data. The height of the bar is proportional to the dependent (quantitative) variable, such as counts, proportions, and averages of measurements.
You can show multiple datasets binned in the same categories in one bar graph by using different shading or colours and clearly labelling them. When the different categories are showing proportions (and add up to 100 %), you can use a stacked bar plot.
Although bar graphs are a good option to visualise discrete variables (count data) on the y-axis, they conceal the data distribution and sample size when the y-axis represents continuous data, e.g., averages16. Therefore, it is often better to plot continuous data using scatter plots, box plots, violin plots, or histograms. These formats visualise the data distribution better. If you want to learn more about this, and for examples of the respective graph types, see this paper by Weissgerber et al. (2019).