python - Outputting a Seaborn heatmap chart of a pandas DataFrame using Bokeh -
i'm trying plot seaborn heatmap chart , output using bokeh.
here's how plot chart:
in [1]: import pandas pd ...: import seaborn sns ...: ...: df = pd.dataframe([['item1',1,2,3,4,'sept'], ...: ['item2',5,6,7,8,'oct'], ...: ['item3',9,10,11,12,'sept'], ...: ['item1',13,14,15,16,'oct'], ...: ['item2',17,18,19,20,'sept'], ...: ['item3',21,22,23,24,'oct']], ...: columns = ['itemname','metric1', ...: 'metric2','metric3','metric4','month']) ...: df out[1]: itemname metric1 metric2 metric3 metric4 month 0 item1 1 2 3 4 sept 1 item2 5 6 7 8 oct 2 item3 9 10 11 12 sept 3 item1 13 14 15 16 oct 4 item2 17 18 19 20 sept 5 item3 21 22 23 24 oct in [2]: df1 = df.pivot(index='itemname',columns='month',values='metric1') ...: ...: df1 out[2]: month oct sept itemname item1 13 1 item2 5 17 item3 21 9 in [3]: sns.heatmap(df1, annot=true) out[3]: <matplotlib.axes._subplots.axessubplot @ 0x2a3836cc2b0>
so far, good. attempt output chart bokeh, using example base:
in [4]: bokeh import mpl ...: bokeh.plotting import output_file, show in [5]: output_file("seaborn_heatmap.html", title="seaborn heatmap example") in [6]: show(mpl.to_bokeh()) warning:c:\users\<username>\anaconda3\lib\site-packages\bokeh\core\validation\check.py:w-1001 (no_data_renderers): plot has no data renderers: plot, viewmodel:plot, ref _id: b78fd176-bffd-4fd0-9b7c-a169d299f541
this results in empty chart. have done wrong?
p.s. reason using bokeh want switch between different sources of values heatmap on fly using dropdown or similar. however, i'm not invested in of libraries used, if can suggest free alternative interactive heatmaps more easily, gladly it.
Comments
Post a Comment