R / ggplot2:在山脊线图中添加直接标签

时间:2019-12-23 22:10:52

标签: r ggplot2 ggridges direct-labels

我正在尝试将directlabels添加到ggridges创建的山脊线图中。似乎directlabels不知道将标签应用于什么。可以指定这个吗?还是两个软件包不兼容?

# does not work
ggplot2::ggplot(iris,
                ggplot2::aes(x = Sepal.Length, y = Species, height = Sepal.Width)) +
  ggridges::geom_density_ridges(stat = "identity") +
  directlabels::direct.label("first.points")

Error in UseMethod("direct.label") : 
  no applicable method for 'direct.label' applied to an object of class "character"
# does not work
ggplot2::ggplot(iris,
                ggplot2::aes(x = Sepal.Length, y = Species, height = Sepal.Width)) +
  ggridges::geom_density_ridges(stat = "identity") +
  directlabels::direct.label.ggplot("first.points")

Error: $ operator is invalid for atomic vectors

0 个答案:

没有答案