I am trying to use ggpaired to show an increase in scores of students before and after a lesson on a 12-point scale. I have my data frame with each students number of correct answers before and after the lesson e.g.
Before | After |
---|---|
6 | 8 |
5 | 9 |
etc x 40 students
The issue I am having is that while ggpaired does a good job of showing the overall increase, since this is discrete data, it is losing the weight of how many students increased their score by X amount. I was able to add geom_count() which gives a sense of how many students scored X on the pre test and Y on the post-test, but am hoping to add a similar weight to the lines connecting the dots
I have produced this graph which is great, but I would love to add weight to the lines in proportion to the number of students who achieved X improvement
Any help is very appreciated!
I found this post which shows an example of how to do this but doesn't quite fit my use case and I am not good enough at coding in R to understand how to change it to apply to my situation: Making a ggpaired plot where line.color is a weighted function?
I don't think there's a way to do this in
ggpaired
, but it's important to realise thatggpaired
is just a wrapper aroundgeom_boxplot
andgeom_line
with some preparatory data wrangling and theme choices, all of which we can do ourselves to get the desired result:Data used for example