How do I manually set the limits of a holoview's colorbar?

孤街浪徒 提交于 2019-12-06 03:44:52

The color range and all other ranges can be set on the Dimension objects of HoloViews Elements. When you declare a HeatMap three (or more) dimensions are created. The first two are the key dimensions (kdims) corresponding to the x- and y-axis of the HeatMap. Secondly there are two or more value dimensions (vdims) the first of which is mapped to the color range. Dimension ranges can be explicitly declared when constructing the object. Here we set the color of the 'z' Dimension, which should be the name of whatever column you are plotting:

hv.HeatMap(..., vdims=hv.Dimension('z', range=(0, 10)))

You can also use the redim interface to override the range after the fact. This will also work when you have a collection of objects, as it will set the range recursively on all objects which contain that dimension and return a new object. That looks something like this:

heatmap = hv.HeatMap(...)
redimensioned_heatmap = heatmap.redim.range(z=(0, 10))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!