本文介绍了在Holoviews热图中更改刻度线周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Holoviews制作的热图.我需要更改x刻度以更改x刻度的周期. [0,2,4,...]代替[0,1,2,3,4,..]

I have the following heatmap made by Holoviews. I need to change x ticks to change the period of x ticks. [0,2,4,...] instead of [0,1,2,3,4,..]

data = [(i, j,  i*j) for i in range(10) for j in range(10)]
hv.HeatMap(data)

从该图更改

此图

推荐答案

使用 HoloViews> = 1.13 ,您现在可以使用关键字.opts(xticks).opts(yticks)设置连续(非分类)范围.

示例:

With HoloViews >= 1.13, you can now use keyword .opts(xticks) and .opts(yticks) for setting continuous (non-categorical) ranges.

Example:

data = [(i, j,  i*j) for i in range(10) for j in range(10)]

hv.HeatMap(data).opts(xticks=[0, 3, 6, 9], yticks=[0, 5, 9])



结果图:



Resulting plot:

这篇关于在Holoviews热图中更改刻度线周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 14:24