I am plotting a stacked histogram, but I cannot see the color of the small value.
My dataframe is: data <- c( samples = c(sample1, sample2, sample 3, sample 4, sample 5, sample6), wins = c(30000, 50000, 700000, 900000, 1020000, 1200000), ties = c(3, 5, 6, 9, 12, 20), location = c(CA, CA, CA, NJ, NY, NY) I want to plot x as samples, y as total (wins and ties) and each histogram bar will have the bottom blue color corresponding to the number of wins and the top yellow color corresponding to the number of ties.
I am using the code below and it seem to work well. It plots the histograms. However the yellow portion (ties) is so small that I cannot see it in the plot. I only see blues. Is there a way to plot the ties (yellow) on top of the blue so I can see it even if small?
df <- plod[,-4] %>%
pivot_longer(-sample, names_to = "games")
ggplot(df, aes(x=sample, y=value, fill = games)) + geom_col() + labs( x = "samples", y = "total games") + scale_fill_manual(values = c(blue, yellow)) + scale_y_continuos(expand = c(0,0), limits = c(0, max(df$value)) + theme_bw()
Hi Matthias Zepper! That was a great advice, thanks!