'Plot observations with same name in different columns in r
I have the next dataframe
df1
Domain Grade Year Score
Reasoning First 2021 0.4
Reasoning Second 2021 0.5
Reasoning First 2022 0.2
Reasoning Second 2022 0.3
Knowing First 2021 0.2
Knowing Second 2021 0.8
Knowing First 2022 0.6
Knowing Second 2022 0.5
Is it possible to get a plot with a facet based on Grade, color by year and showing a different bar for every observation?
Solution 1:[1]
You can use geom_col()
ggplot(df, aes(Domain,Score,fill=factor(Year))) +
geom_col(position="dodge") + facet_wrap(~Grade) +
labs(fill="") + theme(legend.position="bottom")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

