plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Allow setting zmid with zmin and zmax in plotly.graph_objects.Heatmap

Open ACastanza opened this issue 3 years ago • 2 comments

Feature request

I've been trying to plot a subset of a ranked list (gene differential expression dataset). I would like the minimum and maximum color scale set to that of the original complete ranked list, with the midpoint set to zero. It currently seems to be impossible in plotly to do this. I can plot the subset with the colorscale min and max set to the original dataset min and max, but this causes the midpoint to no longer be set to zero.

It can be desirable to set a colorscale to the minimum and maximum of a positive/negative spanned dateset with unequal absolutes but to still have the midpoint at zero without needing to construct and entirely custom colorscale. zmid being ignored when zmax and zmin are set just seems a super odd behavior to me.

ACastanza avatar Mar 11 '22 19:03 ACastanza

I figured out a hacky workaround for this. I generate a heatmap with the original complete dataset setting zmid=0, then extract the ['colorscale'] attribute from the object. Then supply that ['colorscale'] to the subset heatmap while setting zmin and zmax to the min and max of the original dataset. Seems to work well enough.

ACastanza avatar Mar 11 '22 20:03 ACastanza

I also find this to be very problematic, and I can't seem to get ACastanza's hacky workaround to work...

kkimatx avatar Jul 15 '22 01:07 kkimatx