Heatmap Center

How can I center data for Bokeh heatmaps?

I’m referencing the logic in seaborn, heatmap param ‘center’ - seaborn.heatmap — seaborn 0.11.2 documentation

Using the bokeh example code for heatmap:

import pandas as pd

from bokeh.charts import HeatMap, bins, output_file, show

from bokeh.palettes import RdYlGn6, RdYlGn9

from bokeh.sampledata.unemployment1948 import data

data[‘Year’] = data[‘Year’].astype(str)

unempl = pd.melt(data, var_name=‘Month’, value_name=‘Unemployment’, id_vars=[‘Year’])

output_file(“heatmap.html”, title=“heatmap.py example”)

hm = HeatMap(unempl, x=‘Year’, y=‘Month’, values=‘Unemployment’, stat=None, sort_dim={‘x’: False}, width=900, plot_height=500, palette=RdYlGn9)

show(hm)

How can I center data for Bokeh heatmaps?

Thanks,

Ben

Hi,

There is nothing currently to do this automatically. However, Bokeh palettes are just plain python lists of colors. if you'd like a diverging colormap, you can create one and pass it as the palette to be used.

Thanks,

Bryan

···

On May 24, 2017, at 12:25, [email protected] wrote:

How can I center data for Bokeh heatmaps?
I'm referencing the logic in seaborn, heatmap param 'center' - http://seaborn.pydata.org/generated/seaborn.heatmap.html

Using the bokeh example code for heatmap:

import pandas as pd

from bokeh.charts import HeatMap, bins, output_file, show
from bokeh.palettes import RdYlGn6, RdYlGn9
from bokeh.sampledata.unemployment1948 import data

data['Year'] = data['Year'].astype(str)
unempl = pd.melt(data, var_name='Month', value_name='Unemployment', id_vars=['Year'])

output_file("heatmap.html", title="heatmap.py example")
hm = HeatMap(unempl, x='Year', y='Month', values='Unemployment', stat=None, sort_dim={'x': False}, width=900, plot_height=500, palette=RdYlGn9)
show(hm)

How can I center data for Bokeh heatmaps?

Thanks,

Ben

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/78412b85-d9dc-4e19-b3de-225460b220bc%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.