0

Newbie to R here. Trying to plot this data using the code below, but running into a problem in that the data is being overlapped by each other. Ideally, I would like to see both pieces of data on each bar, but currently, the greater value is dominating. Is there any way to change the opacity bars or solve the issue?

{ggplot(data_income_BA) +
        geom_col(aes(x = Degree, 
                 y = Male,),
                 fill = 'blue',
                 width = 0.7) +
        geom_col(aes(x = Degree,
                 y = Female),
                 fill = 'red',
                 width = 0.7) +
        theme_classic() +
        ggtitle("Gender Divide",
                subtitle = "BA ") +
        labs(x = "Degrees", 
             y = "Male + Female")}
Adam Quek
  • 6,973
  • 1
  • 17
  • 23
Barney
  • 1
  • 1
  • 2
    Probably better to tidy the data so that you have a column sex rather than columns Male and female. That will make it much easier to plot. see e.g. https://stackoverflow.com/questions/3777174/plotting-two-variables-as-lines-using-ggplot2-on-the-same-graph/3777592#3777592 with pivot_longer – Richard Telford May 23 '22 at 20:56
  • Have a look at the ggplot2 position options, specifically position_dodge() https://ggplot2.tidyverse.org/reference/#position-adjustment – Caspar V. May 23 '22 at 23:14

0 Answers0