Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
talgalili opened this issue Mar 17, 2016 · 3 comments
Closed

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

talgalili opened this issue Mar 17, 2016 · 3 comments

Comments

@talgalili
Copy link
Contributor

(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 
> 

@talgalili
Copy link
Contributor Author

It seems that #526 solved this issue. (this issue can be closed once it is pulled into master)

@cpsievert
Copy link
Collaborator

Fixed via dd9a3fa

@talgalili
Copy link
Contributor Author

Works beautifully, thanks Carson!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants