-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
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
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
Metadata
Metadata
Assignees
Labels
No labels
