geom_xspline not implemented in plotly - getting error message when using ggplotly() function
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I get an error message when trying to implement geom_xspline with
plotly.
I get the desired graph in ggplot2 but the plot cannot be converted to a
plotly object when using the ggplotly function.
You can find the code showcasing this below.
library(pacman)
pacman::p_load(tidyverse, datasets, plotly, ggplotly, ggalt)
# airmiles built-in dataset:
airmiles <- datasets::airmiles
year <- 1937:1960
airmiles <- data.frame(year = year, airmiles = airmiles)
# "line" plot using geom_xspline from ggalt package:
plot_airmiles <- ggplot(data = airmiles,
aes(x = year, y = airmiles)) +
geom_point(alpha = 0.75) +
geom_xspline(spline_shape = -0.7) +
scale_y_continuous(n.breaks = 10)
plot_airmiles
# interactive plot: using ggplotly doesn't work
ggplotly(plot_airmiles)
Could this be implemented in plotly? Is there any way I can still
produce the interactive graph in plotly without waiting for this to be
implemented?
The plotly documentation (https://linking.plotly-r.com/custom-geoms)
mentions the possibility of creating custom geoms and using the
to_basic() function from the plotly package to “convert” the custom geom
into a geom plotly understands.
In the link above, the authors provide an example for geom_xspline
specifically but their method and code don’t work unfortunately.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用提供的 airmiles 示例、geom_xspline 和 ggplotly() 重现该故障。阅读 issue 中链接的 custom-geoms 文档,然后检查其中描述的 to_basic() 方法。完成的标准是 geom_xspline 可以转换为 plotly 对象,或者已记录受支持的限制和 workaround。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100