From ff75dfc0d15bf35f2fc0eba1483f825956ffe1d6 Mon Sep 17 00:00:00 2001 From: Igor Zakhlebin Date: Thu, 26 Oct 2017 17:05:50 -0500 Subject: [PATCH] Fix reversed color scale in annotated heatmap Currently, `reversescale` does not get included into the `trace` dictionary. Therefore, color scale doesn't change when setting it to `True` (although the color of annotations gets inverted). --- plotly/figure_factory/_annotated_heatmap.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plotly/figure_factory/_annotated_heatmap.py b/plotly/figure_factory/_annotated_heatmap.py index ba1985fd704..5e3e36c42df 100644 --- a/plotly/figure_factory/_annotated_heatmap.py +++ b/plotly/figure_factory/_annotated_heatmap.py @@ -63,6 +63,7 @@ def create_annotated_heatmap(z, x=None, y=None, annotation_text=None, defined, the colors are defined logically as black or white depending on the heatmap's colorscale. :param (bool) showscale: Display colorscale. Default = False + :param (bool) reversescale: Reverse colorscale. Default = False :param kwargs: kwargs passed through plotly.graph_objs.Heatmap. These kwargs describe other attributes about the annotated Heatmap trace such as the colorscale. For more information on valid kwargs @@ -92,14 +93,14 @@ def create_annotated_heatmap(z, x=None, y=None, annotation_text=None, if x or y: trace = dict(type='heatmap', z=z, x=x, y=y, colorscale=colorscale, - showscale=showscale, **kwargs) + showscale=showscale, reversescale=reversescale, **kwargs) layout = dict(annotations=annotations, xaxis=dict(ticks='', dtick=1, side='top', gridcolor='rgb(0, 0, 0)'), yaxis=dict(ticks='', dtick=1, ticksuffix=' ')) else: trace = dict(type='heatmap', z=z, colorscale=colorscale, - showscale=showscale, **kwargs) + showscale=showscale, reversescale=reversescale, **kwargs) layout = dict(annotations=annotations, xaxis=dict(ticks='', side='top', gridcolor='rgb(0, 0, 0)',