teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
534 stars 32 forks source link

Ggplotly will move x-axis back to default position #148

Closed meldarionqeusse closed 4 months ago

meldarionqeusse commented 4 months ago
install.packages("ggh4x")
install.packages("plotly")
library(ggh4x)
library(plotly)

df <- data.frame(x = c(0, 1), y=c(-0.2,0.2))

g <- ggplot(df, aes(x, y)) +
  geom_point() +
  theme(axis.line = element_line()) +
  coord_axes_inside(labels_inside = TRUE)
g  #shows xaxis correctly 
ggplotly(g) #displays x axis in default positions

Output of g

image

Output of ggplotly(g)

image

teunbrand commented 4 months ago

Thanks for the report! I empathise with the problem, but there is very little I can do to change this. For a sizeable part, ggplotly reimplements the build method of ggplots. As far as I'm aware, there isn't a way in which extensions can interfere with that custom build method. So in the current situation, I cannot fix this.