In my scatterplot, I would like to replace the names of the tick marks (1 to 8) with the corresponding CEFR levels (A1.1 to B2.2) without changing the data frame.
1 = A1.1,
2 = A1.2,
3 = A2.1,
4 = A2.2,
5 = B1.1,
6 = B1.2,
7 = B2.1,
8 = B2.2
My code:
ggplot(data = doppelratings1_mit_ID,
aes(x = R1 , y = R2)) +
geom_jitter(shape=1, width = 0.05, height = 0.15) +
geom_smooth() +
xlab("Rater 1") +
ylab("Rater 2") +
ggtitle("Korrelation zwischen Rater 1 und 2", paste("n = 19 Texte ")) +
theme_bw(12)+
geom_abline(intercept = 0, slope = 1)
I tried
CEFR <- c("A1.2", "A2.2", "B1.2")
And then
+ scale_x_discrete(labels= CEFR)
but then the tick marks disappeared.
Thanks for your help!
See my scatter plot:
Add this to your plot definition:
tick_names <- c('A1.1', 'A1.2', ..., 'B2.2')
ggplot() +
... +
scale_x_continuous(breaks = 1:8, labels = tick_names, limits = c(1, 8)) +
scale_y_continuous(breaks = 1:8, labels = tick_names, limits = c(1, 8))