ropensci / iheatmapr

Complex, interactive heatmaps in R
https://docs.ropensci.org/iheatmapr
Other
267 stars 35 forks source link

Formatting questions #13

Open mantisboxer opened 7 years ago

mantisboxer commented 7 years ago

Great package! It's a great step up from d3heatmap and heatmaply. I'm looking for some ways to do a few things that aren't obvious to me right now:

  1. Control number of digits displayed in hover - having so many digits is not very clean look and I would rather not alter my data source

  2. Add grid lines to enhance contrast and better direct eyes with sparse heatmaps

  3. Add an overall title to individual elements or entire group of maps.

Best regards,

Marlon

AliciaSchep commented 7 years ago

Hi Marlon,

Thanks for bringing up these formatting issues!

For 1, right now the only way to do this is to alter the input data, but I agree that it would be nice for it to be possible to only affect the printing. Perhaps a digits argument controlling how many digits to display, with a sensible default, would be a good idea! Or a sensible default formatting and an option to put in your own text matrix for the tooltip if you want to deviate from the default in any way.

For 2, I think this may be technically possible right now with 'layout' argument, but tedious and very non-obvious. I will look more into this to see how easy it would be to support (and/or more specifics for the potential current solution).

For 3, the add_col_title function can be used to add titles above/below any individual heatmap. Adding on overall title seems like it would be a useful additional feature. I would think that this would be text that would go either on the top or bottom of everything and be either left, center, or right aligned with respect to the whole plot. Is that what you have in mind?

Cheers, Alicia

mantisboxer commented 6 years ago

Alicia,

What you described for add add_chart_title function is exactly what I was thinking.

And a digits argument to the main_heatmap function would also be nice. I don't know the internals of plotly, but I would guess there may be something there already. I believe the heatmaply widget had a digits parameter.

AliciaSchep commented 6 years ago

iheatmapr version 0.4.0 now has support for additional customization of tooltip text. By default, only 3 significant digits are shown for value. What is shown for value can be controlled by the "text" argument to main_heatmap. Rather than just allowing for a digits option, it can allow you to have something totally different than the actual numeric data (e.g. if you wanted to map text descriptions to the values). For different rounding or formatting, you could pass along a rounded/formatted version of the data.

Hoping to get to chart title issue as well, although will want to consider how it relates to #14 question about adding custom text annotations.