作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我用 ggalluvial
与 ggplot2
,不过,我希望能够在不附加 ggalluvial
的情况下生成相同的图但仅指定其用途 ggalluvial::
.如果没有附加,我会收到以下错误:Error: Can't find stat called "stratum"
.
d <- data.frame(
status = rep(c("state1","state2","state3"), rep(90, times=3)),
cellIndex = rep(seq_len(90), times=3),
cellCategory = c(rep(letters[seq_len(3)], each=30),
rep(letters[c(2,3,1)], each=30),
rep(letters[c(3,1,2)], each=30))
)
ggplot2::ggplot(data=d, ggplot2::aes(x=status, stratum=cellCategory, alluvium=cellIndex,
fill=cellCategory, label=cellCategory)) +
ggalluvial::geom_flow(stat="alluvium", lode.guidance="rightleft", color="darkgray") +
ggalluvial::geom_stratum() +
ggplot2::geom_text(stat="stratum", size=3)
最佳答案
这是一个艰难的过程---深入研究 code for ggplot2 , stat 参数粘贴您提供的字符串,然后在您所在的环境中查找该对象(在本例中为“StatStratum”)。因为您不想加载包,所以它将无法找到它(并且没有办法改变论点本身)。
回答
因此,您需要像这样从 ggalluvial 包中保存该对象:
StatStratum <- ggalluvial::StatStratum
关于r - 指定 `stratum` 和 `alluvium` 参数而不附加 ggalluvial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53797744/
我用 ggalluvial与 ggplot2 ,不过,我希望能够在不附加 ggalluvial 的情况下生成相同的图但仅指定其用途 ggalluvial:: .如果没有附加,我会收到以下错误:Erro
我是一名优秀的程序员,十分优秀!