Bokeh Scatter plot works fine, HeatMap does not - come out blank without any error

I am using Python 3.5, bokeh 12

I have no error showing up, so I dont even know what other information I can share here…It just comes up as blank… my default output bowser is Internet Explorer 11

Without providing some code to run or at least inspect it is impossible to speculate.

Thanks,

Bryan

···

On Jul 26, 2016, at 21:46, [email protected] wrote:

I am using Python 3.5, bokeh 12

I have no error showing up, so I dont even know what other information I can share here…It just comes up as blank… my default output bowser is Internet Explorer 11

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/747ed090-9d3a-43b9-bb75-9186603bbeb8%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Understand.. Ok let me paste a dummy code here, 2 tics

import pandas as pd
from bokeh.charts import HeatMap, show

wb_dummy = pd.read_excel(‘sheet.xlsx’, ‘Dummy’,
skiprows=4,parse_cols=‘K:R’)
df_dummy = wb_dummy.dropna(axis=0) #i do this, else the df is all the rows - way more than my data - and then bokeh doesnt like the NaN data
df_dummy[‘Exposure’] = df_dummy[‘Exposure’]/1000000

hm = HeatMap(df_dummy,y=‘Code’,x=‘Rating’,values=‘Exposure’,title=‘Test’,hover_tool = True, hover_text=‘Code’ )
print(df_dummy.head())
print(df_dummy.tail())
show(hm)

``

Output:

          ID Code Rating A B C D Exposure
0 24494.0 P iA+ no no -51901.0 97616211.0 97.564310
1 69709.0 P iA no no 88525.0 48236196.0 48.324721
2 93372.0 O iBBB- no no 1820.0 30030981.0 30.032801
3 82794.0 I iA no no -82069.0 82453308.0 82.371239
4 64639.0 F iA- no no -73379.0 52490884.0 52.417505
ID Code Rating A B C \
332 5737.0 PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP iBBB no no 98435.0 333 33883.0 KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK iBB- no no -91829.0 334 2654.0 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE NR no no 23626.0 335 79586.0 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG iBBB no no -53147.0 336 66791.0 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF iBBB+ no no -68901.0 D Exposure 332 78064766.0 78.163201 333 92163471.0 92.071642 334 27148816.0 27.172442 335 34729739.0 34.676592 336 40699345.0 40.630444

After playing with the dummy data, I can see that with the above data it works… but the minute I replace the data in the column ‘Code’ with my data (which are just client names, and may have spl characters such as '/,-,,&,. and have long length… max is 83 characters) it fails and I get a blank page out…

Note my Exposure column has +ve as well as -ve numbers (going fwd I will make all -ve nums as 0 as I only care about +ve ones)

I am ofcourse unable to share the client names… but what should I look out for in them?

pls ignore the below qs if I should be raising them seperately

Secondly, the legend which comes out is in raneg 1-4 (4 diff colours) but nothing to do with my values (‘Exposure’ column) why is that’?

Finally, I would like the Rating to be in a particular order but I think there are certain examples available elsewhere about weekdays / months etc and will take it from there - however if there is a way in which I can input the order itself - pls do let me know. Thanks vm!

···

On Wednesday, July 27, 2016 at 11:05:07 AM UTC+8, [email protected] wrote:

Understand… Ok let me paste a dummy code here, 2 tics

Hello,

It is kind of difficult to see what is your problem without looking at the actual data.

Using the description you provided for the names, I created a function to generate random names and then tried creating a heat map. You can see the code in the Jupyter Notebook attached, and it looks like everything is working well even with really weird names. I would suggest to check your name column and if required do some processing.

Now, regarding your second question: if you read the Bokeh documentation for the heatmap, you will notice it talks about stat:

stat (str, optional) – the aggregation to use. Defaults to count. If provided None, then no aggregation will be attempted. This is useful for cases when the values have already been aggregated.”

So Bokeh is attempting to aggregate the data before plotting the map. If you change this to None you will see the values of exposure instead.

Play around with the order of the Rating, if you get stuck just post another question.

Best!

Heat Map.ipynb (51 KB)