Reputation: 1307
I am using hv.HeatMap
to plot a connectiviy matrix. I would like to disable the viszualization of the gridlines. At first I thought this should be possible be disabling show_grid
but this does not have any effect on the gridlines.
For example, how would one disable the visulization in the last example from the documentation?
heatmap = hv.HeatMap((np.random.randint(0, 10, 100), np.random.choice(['A', 'B', 'C', 'D', 'E'], 100),
np.random.randn(100), np.random.randn(100)), vdims=['z', 'z2']).sort().aggregate(function=np.mean)
heatmap.opts(opts.HeatMap(tools=['hover'], colorbar=True, width=325, toolbar='above', clim=(-2, 2)))
which produces:
When you have a close look (or better zoom in, using the interactive plot on the documentation page), you can see, that all 'boxes' are surrounded with a white border. I would like to disable this.
Upvotes: 0
Views: 375
Reputation: 6347
To activate or deactivate a grid you can add show_grid=True
or show_grid=False
to opts.HeatMap(...)
.
But in your example there is no grid activated, so you can't deactivate the grid lines. The white lines you can see are coming through the background color (which is defined by default as white).
You could change the background adding bgcolor ='#ABABAB'
to opts.HeatMap(...)
, which makes a figure like
But sometimes you have to apply the changes you want to make directly in the bokeh figure object because not all the possibilities are added to holoviews
keyword arguments. If you have to do this, you can follow this introduction.
Extend your example with the following to add an alpha value to the background as an example:
from bokeh.io import (
show,
export_png,
export_svgs,
output_file,
save,
)
# get bokeh object
fig = hv.render(heatmap)
# make some changes
fig.background_fill_alpha = 0.5
# show figure in notebook
show(fig)
If you have an bokeh figure object and want to save the figure as png
, html
or svg
you cant use
holoviews` anymore, because there is no way to transform it back (as far as I know).
Then you have to use the the functions available from bokeh.io
to save them.
You can use:
# png
export_png(fig, filename = 'heatmap.png')
# svg
fig.output_backend = "svg"
export_svgs(fig, filename = 'heatmap.svg')
# html
output_file('heatmap.html', mode='inline')
save(fig, filename = 'heatmap.html', title = 'heatmap', resources=None)
All thise and more is explained in the bokeh.io
documentation
Upvotes: 1