Problem with titles and subplot

Nice job getting the reprex together.

I don't know why the ggtitle info isn't carried through. However, I've used a sort of "trick" to add titles to single plots via faceting in the past that appears to work here.

In this case you can facet by JourLettre. Since there is only one value per data subset, this has the effect of adding a "title" via the facet strip.

I did this in lapply() to put your plots into a list to use in subplot(), but the fundamental idea is the same. You see I removed ggtitle() but added a line for facet_wrap().

plots = lapply(c("lun","mar","mer","jeu","ven","sam","dim"), function(i) {
    ggplotly( ggplot(RIF[RIF$JourLettre==i, ], aes(x = InterFournee)) +
                  stat_ecdf(geom = "point") +
                  facet_wrap(~JourLettre) )
})

These strip titles stay when putting things into subplot().

subplot(plots, nrows=3,heights=c(0.3,0.3,0.3),margin=0.023) %>%
       layout(title="Interfournees en cumule par jour")

4 Likes