teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous

Home Page:https://teunbrand.github.io/ggh4x/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ggplotly will move x-axis back to default position

meldarionqeusse opened this issue · comments

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

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.