plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

Facet labels get cut off when rotated

Open kojisposts opened this issue 6 years ago • 3 comments

I suspect this is a similar issue to #1224 : when graphs are facetted vertically, and the facet labels rotated to be horizontal, the labels are cut off. (Where there is a legend, it overlaps; where there isn't, it's cut off entirely.)

p <- flights %>%
  ggplot(aes(y=origin, x=dest, colour=origin)) +
  geom_count() +
  facet_grid(name ~.) +
  theme(strip.text.y = element_text(angle = 0),
        legend.position = "none")
ggplotly(p)

スクリーンショット 2019-08-08 午後6 09 23 スクリーンショット 2019-08-08 午後6 09 45

kojisposts avatar Aug 08 '19 22:08 kojisposts

Hello, I met the same issue, I would be grateful for a solution ! thanks

SoaJoli avatar May 11 '20 15:05 SoaJoli

I fixed this issue with : p<-ggplotly(p,tooltip = c("y", "x", "fill"), width = cdata$output_plot2_width, height = cdata$output_plot2_height) %>% layout(legend = list(orientation = 'v',xanchor= "top",x = 1.1, y = 1))

SoaJoli avatar May 12 '20 08:05 SoaJoli

Adapting pat-alt's comment here, this seems to work:

ggplotly(my_gg_plot) |>
      layout(margin = list(r=200))

AlexWeinreb avatar Jul 29 '24 15:07 AlexWeinreb