这个情节叫什么,我怎样才能用 ggplot2 制作它?

What is this plot called and how can I make it with ggplot2?

考虑像上面那个这样的情节:

我想重新创建这种图(曲线散点图),它指示样本通过中值周围曲线的分布。到目前为止,我的搜索还没有成功。

有谁知道吗:

  1. 这个情节怎么称呼?
  2. 如何使用 ggplot2 创建此图?
  3. 每个分类变量具有等距点的散点图可以用 geom_point() 完成吗?

原始出处:https://www.nature.com/articles/nature12213/figures/1

它只是对离散的点进行排序和间隔吗?你可以相当容易地制作你自己的 geoms(见 this guide)/也许是像

StatSlide <- ggproto("StatSlide", Stat,
  compute_group = function(data, scales) {
    data$y <- sort(data$y)
    data$x <- data$x + seq( -.4, .4, length.out = nrow(data))
    data
  },
  required_aes = c("x", "y")
)

stat_slide <- function(mapping = NULL, data = NULL, geom = "point",
                       position = "identity", na.rm = FALSE, show.legend = NA, 
                       inherit.aes = TRUE, ...) {
  layer(
    stat = StatSlide, data = data, mapping = mapping, geom = geom, 
    position = position, show.legend = show.legend, inherit.aes = inherit.aes,
    params = list(na.rm = na.rm, ...)
  )
}

# test it out
ggplot(mpg) + 
  stat_slide(aes(drv, displ, color=drv))