在我的散点图中,剩余了一些空白,我还没有设法通过手动或xlim()
命令或scale_x_discrete(limits=())
来缩小它。我的代码:
ggplot(data = doppelratings2_mit_ID,
aes(x = R1, y = R3)) +
geom_jitter(shape = 1, width = 0.1, height = 0.1) +
geom_smooth()+
xlab("Rater 1") +
ylab("Rater 3") +
ggtitle("Korrelation zwischen Rater 1 und 3", paste("n = 17 Texte ")) +
theme_bw(12)+
geom_abline(intercept = 0, slope = 1)+
scale_x_discrete(breaks = 1:5, labels = tick_names_5, limits = c(1:5))+
scale_y_discrete(breaks = 1:6, labels = tick_names_6, limits = c(1:6))
还有data:
> dput(doppelratings2_mit_ID_für_Stackoverflow)
structure(list(ID = c(6584209, 6598108, 6584103, 6552101, 6608303,
6656213, 9734115, 9554201, 9554108, 9604202, 6660108, 6520103,
6726215, 6574106, 9762121, 9688202, 9576108), R1 = c(2, 3, 2,
3, 3, 2, 3, 4, 4, 5, 4, 4, 2, 2, 3, 4, 4), R3 = c(2, 3, 3, 3,
2, 2, 3, 5, 5, 6, 4, 4, 2, 2, 3, 3, 4)), row.names = c(NA, -17L
), class = c("tbl_df", "tbl", "data.frame"))
感谢您的帮助!
答案 0 :(得分:2)
您可以尝试
ggplot(data = d,
aes(x = R1, y = R3)) +
geom_jitter(shape = 1, width = 0.1, height = 0.1) +
geom_smooth()+
xlab("Rater 1") +
ylab("Rater 3") +
ggtitle("Korrelation zwischen Rater 1 und 3", paste("n = 17 Texte ")) +
theme_bw(12)+
geom_abline(intercept = 0, slope = 1) +
scale_x_continuous(breaks = min(d$R1):max(d$R1), labels = LETTERS[1:length(min(d$R1):max(d$R1))]) +
scale_y_continuous(breaks = min(d$R3):max(d$R3), labels = LETTERS[1:length(min(d$R3):max(d$R3))])
然后,您可以添加+ coord_cartesian(ylim=c(min(d$R3),6))
来更改限制并接收该图。