Skip to content

ggplotly - axis titles still overlapping with labels when converting faceted plot #1224

Closed
@hms1

Description

@hms1

The issue with axis titles overlapping with axis labels, fixed in the latest version of plotly, appears to still be present when using ggplotly to convert a faceted ggplot.

When converting an unfaceted ggplot, the new automargin=TRUE attribute works perfectly:

mpg_plot <- mpg %>%
  ggplot(aes(x = cyl, fill = trans)) +
  geom_bar() 

ggplotly(mpg_plot) %>% 
  layout( 
  xaxis = list(automargin=TRUE), 
  yaxis = list(automargin=TRUE)
  )

image
However, when adding a facet, the old issue of overlap between axis titles and labels persists:

mpg_plot_faceted <- mpg_plot + facet_wrap(. ~ fl)

ggplotly(mpg_plot_faceted) %>% 
 layout( 
 xaxis = list(automargin=TRUE), 
 yaxis = list(automargin=TRUE)
 )

image

Thanks,

Henry

For reference, the original plotly issue and related fix:

plotly/plotly.js#1504
plotly/plotly.js#2243

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions