休息之间的空间数量也很大 - ggplot2

时间:2018-06-08 18:47:03

标签: r ggplot2

我正在创建一个Bland-Altman图,并且确实希望确保x轴上的间隔相等。如果你看下面的图,每次休息之间的空间量是不均匀的。我怎样才能确保x< 400和400< x< 500,500< 500 x< 600和600< x< 700等都一样吗? plot

 ggplot(vals_df, aes(x = means, y = diffs)) +
  geom_point(alpha = 0.5) +
  geom_hline(yintercept = mean(vals_df$diffs), colour = "blue", size = 0.5) +
  geom_hline(yintercept = mean(vals_df$diffs) - (1.96 * sd(vals_df$diffs)), colour = "red", size = 0.5) +
  geom_hline(yintercept = mean(vals_df$diffs) + (1.96 * sd(vals_df$diffs)), colour = "red", size = 0.5) +
  scale_y_continuous(breaks = sort(c(round(mean(vals_df$diffs), 1), -400, -200, 0, 200)), labels = scaleFUN) +
  ylab("Difference in total night sleep duration: \n survey versus sleep diary") +
  xlab("Mean of total night sleep duration: \n survey and sleep diary")

0 个答案:

没有答案