Open ethantenison opened 2 years ago
A while back, I implemented a workaround to address some heatmap colorings for our own application
fig = dashbio.Clustergram(
data=values
, column_labels=col_labels
, row_labels=row_labels
, hidden_labels=hidden_labels
, cluster=cluster
, col_dist=col_dist
, row_dist=row_dist
, center_values=center_around_zero
, color_map=colorscale
, display_ratio=0.3 # Make dendrogram slightly bigger relative to plot
, line_width=1 # Make dendrogram lines thicker
, log_transform=False if is_log10 else True
)
fig.data[-1]["reversescale"] = reverse_colorscale
if center_around_zero:
fig.data[-1]["zmid"] = 0
else:
# both zmin and zmax are required
fig.data[-1]["zmin"] = 0
fig.data[-1]["zmax"] = max(map(max, fig.data[-1]["z"])) # Highest z-value in 2D array
# do extra stuff and return "fig"
Basically in the returned clustergram figure (fig), the last element in fig.data
is the heatmap and you can change the heatmap properties. For this example, the color range will be set depending on if we want to center the expression values around zero or not.
I'm trying to creating a clustergram using a correlation matrix, and I'd like the color scale to be from -1 to 1 regardless of what is present in the data. Without manually setting it the results can be deceiving visually.
In the plotly go heatmap you set it by specifying zmin and zmax, but I don't see an equivalent from the clustergram documentation here.
Here's what my clustergram looks like:
You can see that the color scale cuts off at around 0.35.