jokergoo / InteractiveComplexHeatmap

Make Interactive Complex Heatmaps
https://jokergoo.github.io/InteractiveComplexHeatmap/
Other
128 stars 24 forks source link

Clickable sub-plot (enhancement) #97

Open EngeLab opened 2 years ago

EngeLab commented 2 years ago

Thank you for a great package, it is a big help in our research when interactively analyzing data!

I have a request for the "default" makeInteractiveHeatmap function. Currently, it is possible to interact only with the main plot. However, many data sets are too large to make out a cell in the full heatmap and it is necessary to first zoom (brush select to the sub heatmap) before selecting a heatmap field to inspect.

Can you expose another set of functions that let you react to "hover" and "click" in the sub-plot? Alternatively, could you give some pointers (in a tutorial for example) of setting this up, eg. in a simplified makeInteractiveHeatmap function?

jokergoo commented 2 years ago

In the current design, it is not possible to do it. But there is a functionality in the app with which you can convert the sub-heatmap to a new interactive heatmap layer. See examples here: https://jokergoo.github.io/InteractiveComplexHeatmap/articles/InteractiveComplexHeatmap.html#recursive-interactive-heatmap-widgets-1

EngeLab commented 2 years ago

Yes, but from what I have seen there is no way to attach a custom "clicked" function to the floating version - it seems to be hard-coded to the default?

What I want to do is to show a plot which related to the row the user clicked on, so the output element is a plot rather than the default text, and the clicked function uses data from other objects to draw it. When creating the shinyApp I can specify a ui that contains a plot (eg.: InteractiveComplexHeatmapOutput(output_ui = imageOutput("test")), and then implement a "click_action" function to draw the plot. However I cant seem to find a way to do this for the floating recursive heat map.

jokergoo commented 2 years ago

Current click_action can only be defined in the first-level. I will think about it.