Open WPettersson opened 9 months ago
Would suggest you try setting plot_method="plotly"
, there's always been weird edge case issues with the scale_gradient fun and I've no time to investigate this at the moment
Thanks, that worked for me. Happy for you to either close this or leave it open depending on whether you (or someone) will want to investigate in the future.
Will leave it open, should be fixed eventually, cheers
Describe the bug
I am displaying a heatmap with a single data point, but its colour is grey despite passing in limits or scale_fill_gradient_fun.
I realise a heatmap with a single data point is silly, it's an edge case in part of a shiny app, details below in additional content.
To Reproduce
Expected behavior
If only one data point is given, and either limits or a gradient with limits are also given, then the data point should be coloured the appropriate colour.
Additional context
It definitely seems weird to show a heatmap with one cell, especially in a static setting. However, in my setting I am creating a Shiny webapp where users can disable/enable various rows and columns of two different heatmaps. Each heatmap corresponds to a different technique, so it makes no sense to combine the data into one heatmap. However, even if one heatmap is reduced to a single cell, it still makes sense to compare the value of this cell, to whatever values are shown in the other heatmap. I am sharing limits and gradients across both heatmaps, so it would be useful to have the colours applied correctly in both heatmaps.
To expand on my situation, imagine data tracking "time taken to get from A to B" across some vehicles. I have one data set for ground-based vehicles, and the heatmap has one axis for "number of wheels" and the other for "size of engine". On the other data set, I have water-based vehicles, and the heatmap has one axis for "number of sails" and the other for "number of masts". It makes no sense to try to put all this data on one heatmap (because there's no data on land-vehicles with any number of masts, nor on water-vehicles with any number of wheels). However, it might still make sense to narrow down land vehicles to just one cell (i.e., 2 wheels and a 250cc engine) and compare that to all water vehicles. In this case, I can apply the same limits to my gradient, and would want the single cell in land vehicles to be coloured according to the gradient.