Closed zji90 closed 7 years ago
Hi Zhicheng Ji, You should be able to take a heatmaply output and use htmlwidgets::as.widget on it. I believe this can then be used within Shiny.
Does this answer your question?
Tal
Thanks for the reply. Can you provide a minimal example how to use the widget functions exactly? I believe this will also be helpful to other shiny users. Thanks!
Hi zji90, I just figured out how to do this using the renderPlotly and outputPlotly functions
Within your server function have something like the following:
library(shiny)
library(heatmaply)
shinyServer(function(input,output) {
output$heatmap <- renderPlotly({
heatmaply(mtcars)
})
})
Then in the ui function have something like
library(shiny)
library(heatmaply)
shinyUI(fluidPage(
titlePanel("My heatmap"),
fluidRow(plotlyOutput("heatmap"))
)
))
Not perfect in terms of formatting, margins etc. but should get you started. Hope that helps!
Thanks! I have successfully incorporated the heatmaply in my shiny app. However, it seems that there is some error with the "save as png" function ("Sorry there was a problem downloading your png"). I am wondering whether you have any suggestion of solving this issue?
Best Jason
From: Marion notifications@github.com Sent: Tuesday, July 12, 2016 7:39:41 PM To: talgalili/heatmaply Cc: Zhicheng Ji; Author Subject: Re: [talgalili/heatmaply] shiny support? (#15)
Hi zji90, I just figured out how to do this using the renderPlotly and outputPlotly functions
Within your server function have something like the following:
shinyServer(function(input,output) { output$heatmap <- renderPlotly({ heatmaply(mtcars) }) })
Then in the ui function have something like
shinyUI(fluidPage( titlePanel("My heatmap"), fluidRow(plotlyOutput("heatmap")) ) ))
Not perfect in terms of formatting, margins etc. but should get you started. Hope that helps!
You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/talgalili/heatmaply/issues/15#issuecomment-232213963, or mute the threadhttps://github.com/notifications/unsubscribe/AD0QUmlpmenGlEXYo3115pDUc3hi2uXMks5qVCW9gaJpZM4JFu-F.
Hi Jason No sorry, I just opened this as an issue last night (https://github.com/talgalili/heatmaply/issues/16), hopefully Tal will look into it although I suspect that it might be a problem with the underlying plotly framework. I have been getting by with screenshots.
Cheers, Marion
I'm also experiencing a problem with downloading the plot as a png. Looking forward to this bug fix soon!
Hi Bohdan, What is your sessionInfo() ? This sounds like a bug in the plotly package (Which might have been fixed in the github version).
Cheers, Tal
Hi Tal,
> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] tools stats graphics grDevices utils datasets methods base
other attached packages:
[1] heatmaply_0.5.0 viridis_0.3.4 plotly_3.6.0 ggplot2_2.1.0 gplots_3.0.1
[6] data.table_1.9.6 shinyapps_0.4.1.8 shiny_0.13.2
loaded via a namespace (and not attached):
[1] gtools_3.5.0 modeltools_0.2-21 reshape2_1.4.1 kernlab_0.9-24
[5] lattice_0.20-33 colorspace_1.2-6 htmltools_0.3.5 stats4_3.3.0
[9] yaml_2.1.13 base64enc_0.1-3 chron_2.3-47 prabclus_2.2-6
[13] RColorBrewer_1.1-2 registry_0.3 fpc_2.1-10 foreach_1.4.3
[17] plyr_1.8.4 stringr_1.1.0 robustbase_0.92-6 munsell_0.4.3
[21] gtable_0.2.0 caTools_1.17.1 htmlwidgets_0.7 mvtnorm_1.0-5
[25] codetools_0.2-14 labeling_0.3 httpuv_1.3.3 seriation_1.2-1
[29] flexmix_2.3-13 class_7.3-14 DEoptimR_1.0-6 trimcluster_0.1-2
[33] Rcpp_0.12.6 KernSmooth_2.23-15 xtable_1.8-2 scales_0.4.0
[37] diptest_0.75-7 gdata_2.17.0 jsonlite_1.0 mime_0.5
[41] gridExtra_2.2.1 digest_0.6.10 stringi_1.1.1 gclus_1.3.1
[45] grid_3.3.0 bitops_1.0-6 magrittr_1.5 tibble_1.2
[49] cluster_2.0.4 whisker_0.3-2 tidyr_0.6.0 dendextend_1.3.0
[53] MASS_7.3-45 iterators_1.0.8 assertthat_0.1.0.99 httr_1.2.1
[57] R6_2.1.3 TSP_1.1-4 mclust_5.2 nnet_7.3-12
Many thanks for your input.
Cheers, Bohdan
I see. Please try the version of plotly on github, see instructions from here: https://github.com/ropensci/plotly And if it still doesn't work, please submit an issue on: https://github.com/ropensci/plotly/issues
The heatmaply package is now tightly integrated into the new shinyHeatmaply package (available on CRAN and github), you are welcome to use it from here: https://github.com/yonicd/shinyHeatmaply/
In the introduction it seems that heatmaply supports shiny. However, I haven't found any discussion of how to incorporate heatmaply in shiny apps both in the package or in the forums. Is it still an ongoing feature?