Hey, I´m trying to create a grouped bar plot for the following data frame: https://seafile.zfn.uni-bremen.de/f/7649d1e0eb2f487a8e93/
Using my code, it will plot the same bars for every value and I don´t really know whats the problem right here.
Would be awesome if someone got an answer why it´s plotting the same bars. Also I´d like to change the Color to a grey palet and get the total amount on the y-axis.
you set stat to identity. The geom_bar() then plotted the value of wert for each level of Relevanz. Since wert and Relevanz are the same information expressed in different forms (gar_nicht_wichtig = 1, Nicht_wichtig = 2, etc.), your plot was identical for every level of button.
Here is a rough version of showing the actual values on the plot. You can adjust the vertical position of the numbers with the vjust argument in geom_text.
library(ggplot2)
library(dplyr)
buttons_long <- read.csv("~/R/Play/dataframe.csv")
buttons_long |> count(button, Relevanz) |>
ggplot(aes(x = button, y = n, fill = Relevanz)) +
geom_col(position = position_dodge()) +
geom_text(aes(label = n), position = position_dodge(width = 0.9)) +
scale_y_log10()