ggplotly geom_line vertical orientation is not working
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied R example using ggplot2's geom_line(orientation="y") and conversion through ggplotly(p). Compare the ggplot2 result with the converted plot and review Plotly's vertical plot orientation documentation. Done means the converted plot preserves the requested vertical orientation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100