我正在尝试将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