ggplotly geom_line vertical orientation is not working
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
ggplot2's geom_line allows setting the y-axis as the independent variable, by plotting in the order of how x is arranged:
library(tidyverse)
library(plotly)
c2 = c(1,2,3,4)
c1 = c(3,2,1,4)
dataset = data.frame(x=c1,y=c2)
p = ggplot(dataset %>%
arrange(y), aes(x=x, y=y))+
geom_point()+
geom_line(orientation="y")+
labs(
y = "Depth", x = "Maximum concentration",
)+
scale_y_reverse()
p
which results in:

however, this does not carry over when the plot is converted to plotly:
g = ggplotly(p)
g

I noted that the plotly documentation does mention orientation as well.
https://plotly.com/ggplot2/line-charts/#vertical-plot-orientation
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 R 示例开始,使用 ggplot2 的 geom_line(orientation="y"),并通过 ggplotly(p) 进行转换。将 ggplot2 的结果与转换后的图进行比较,并查阅 Plotly 关于垂直绘图方向的文档。当转换后的图保留所请求的垂直方向时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100