Skip to content

subplot() no longer seem to work with ggplotly objects (bug) #520

@talgalili

Description

@talgalili

(on plotly_3.4.6)

For example:

library(plotly)
## Not run: 
p1 <- plot_ly(economics, x = date, y = uempmed, showlegend = F)
p2 <- plot_ly(economics, x = date, y = unemploy, showlegend = F)
subplot(p1, p2, nrows = 1) # works

library(ggplot2)
ggp1 <- qplot(data = economics, x = date, y = uempmed)
ggp2 <- qplot(data = economics, x = date, y = unemploy)

subplot(ggp1, ggp2, nrows = 1) # fails - only shows 1 plot

ggp1_ly <- ggplotly(ggp1)
ggp2_ly <- ggplotly(ggp2)

subplot(ggp1_ly, ggp2_ly, nrows = 1) # fails - only shows 1 plot

This is how the first figure looks (and should look):
image

Here is how the two other subplots figures look like (they show one figure instead of two = BUG ):

image

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Hebrew_Israel.1255  LC_CTYPE=Hebrew_Israel.1255   
[3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C                  
[5] LC_TIME=Hebrew_Israel.1255    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] plotly_3.4.6    ggplot2_2.1.0   installr_0.17.2

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3      tidyr_0.4.1      assertthat_0.1   dplyr_0.4.3     
 [5] digest_0.6.9     grid_3.2.3       plyr_1.8.3       R6_2.1.2        
 [9] DBI_0.3.1        jsonlite_0.9.19  gtable_0.2.0     magrittr_1.5    
[13] scales_0.4.0     httr_1.1.0       viridis_0.3.4    labeling_0.3    
[17] tools_3.2.3      htmlwidgets_0.6  munsell_0.4.3    yaml_2.1.13     
[21] parallel_3.2.3   base64enc_0.1-3  colorspace_1.2-6 htmltools_0.3   
[25] gridExtra_2.2.1 
> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions