tash-0
tash-0

Reputation: 33

Making a Bokeh Heat map with a 20 x 1000 numpy array

My Goal is to make a heat map like this one bokeh heatmap

The only difference is my array is much larger 30x3000. It seems like bokeh should be able to handle something like this but when I try I get something that looks like this: my version with large numpy array.

If I zoom in a lot I can start to see the color coding but I would like it to not look like that at first pass.

I am new to Bokeh but it seems like something quite trivial. I usually use imshow in python. But, am trying to switch over.

EDIT: Here is the code:

from bokeh._legacy_charts import HeatMap, output_file, show

xyvalues = np.random.random((28,1000))

df = pd.DataFrame(xyvalues)

output_file('heatmap.html')

hm = HeatMap(df)

show(hm)

Upvotes: 3

Views: 3322

Answers (1)

birdsarah
birdsarah

Reputation: 1165

The heat map gives you a single "cell" for each of your categories. If you have 3000 categories and your plot is 1000px wide, that makes each cell less than 1px wide.

If I make your bokeh plot very wide by setting width hm = HeatMap(df, width=3000)then I can see colors immediately.

enter image description here

In Bokeh, ImageRGBA is more similar to imshow.

Upvotes: 2

Related Questions