1

I've found that with Plotly with R, when I'm faceting plots, they often don't translate properly from R to Plotly.

For example, my graph plotted in R looks like so:

enter image description here

When I send it to plotly, it looks like so:

enter image description here

(Some data has been hidden from both plots for confidentiality reasons)

My code looks like so:

plot <- ggplot(sytoxG_data_no_NC) +
  geom_ribbon(data = confidence_intervals_SG, mapping = aes(x = time_elapsed, ymin = phenotype_value.NC.lower, ymax = phenotype_value.NC.upper,
                                                            fill = "red", colour = NULL), alpha = 0.6) +
  scale_fill_manual(name = "Legend",
                    values = c('red'),
                    labels = c('Negative Control')) +
  xlab("Time Elapsed") +
  ylab("Sytox Green") +
  ggtitle("Sytox Green - Facets: Pathway") +
  facet_wrap(~Pathway, ncol=6, scales = "fixed") +
  theme(panel.grid = element_blank(),
        axis.ticks.length = unit(0, "cm"),
        panel.background = element_rect(fill = "white"),
        strip.text.x = element_text(size=4),
        axis.text = element_blank())
response <- py$ggplotly(plot, kwargs=list(world_readable=FALSE, filename="SG_sparklines_by_pathway", fileopt="overwrite"))
maia
  • 3,910
  • 4
  • 27
  • 34
  • Thanks for reaching out! Could you post a simple example (with data) in our GitHub issues here? https://github.com/ropensci/plotly/issues?q=is%3Aopen+is%3Aissue – Chris P Mar 06 '15 at 00:15
  • A possible solution is here: https://stackoverflow.com/questions/46281534/ggplotly-removing-data-from-single-facet – Marco Sandri Sep 18 '17 at 16:07

2 Answers2

0

The issue might very well be with geom_ribbon rather than facets... Can you please upgrade your "plotly" package and give it another try?

mkcor
  • 489
  • 4
  • 6
  • I don't think it is, I'm having the same problem. Data for some facets just doesn't show up. – Nova Sep 30 '16 at 17:14
0

I wound up using facet_grid instead of facet_wrap. Something like this:

+ facet_grid(~Pathway, scales = "free", space="free")