I'm trying to make a boxplot with four categories and two groups in each. The result differs on each run without me changing the code. I have R version 4.1.2 and ggplot2 3.3.5.
There are no NA's.
The code:
ggplot(temp_df2, aes(x=Category,y=Analysis,fill=Sex)+geom_boxplot()
Some of the results below. The first one is the correct one and the rest are obviously incorrect. I didn't make any changes between runs. There are many more incorrect results, but here are two of them so that you get the idea. The correct result comes around 1/5 to 1/10 of times.
The correct result
Incorrect 1
Incorrect 2
Any idea what's wrong? Any other ways to get the correct result?