HoloViews 创建插值彩色热图
HoloViews create interpolated colorful heatmap
我在散景之上使用全息视图创建了一个热图
import numpy as np
import pandas as pd
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')
df = pd.DataFrame(np.random.rand(10, 10) * 100)
heatmap = hv.HeatMap((df.columns, df.index, df))
heatmap.opts(width=500, title='Thermal map', colorbar=True, tools=['hover'], cmap='Turbo')
并得到以下热图:
如何使热图颜色插值与颜色条相同
就像从一个像素到另一个像素的渐变移动
类似于:
谢谢!!
依靠 post 评论,我能够插入热图,尤其是 James A. Bednar 评论。
import holoviews as hv
from holoviews import opts
from holoviews.operation.datashader import regrid
df = pd.DataFrame(np.random.rand(10, 10) * 100)
img = hv.Image((df.columns, df.index, df))
img.opts(width=500, height=500, title='Thermal map', cmap='RdYlBu_r' ,tools['hover'], colorbar=True)
inter_img = regrid(img, upsample=True, interpolation='bilinear')
img + inter_img
非常感谢
我在散景之上使用全息视图创建了一个热图
import numpy as np
import pandas as pd
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')
df = pd.DataFrame(np.random.rand(10, 10) * 100)
heatmap = hv.HeatMap((df.columns, df.index, df))
heatmap.opts(width=500, title='Thermal map', colorbar=True, tools=['hover'], cmap='Turbo')
并得到以下热图:
如何使热图颜色插值与颜色条相同
就像从一个像素到另一个像素的渐变移动
类似于:
谢谢!!
依靠 post 评论,我能够插入热图,尤其是 James A. Bednar 评论。
import holoviews as hv
from holoviews import opts
from holoviews.operation.datashader import regrid
df = pd.DataFrame(np.random.rand(10, 10) * 100)
img = hv.Image((df.columns, df.index, df))
img.opts(width=500, height=500, title='Thermal map', cmap='RdYlBu_r' ,tools['hover'], colorbar=True)
inter_img = regrid(img, upsample=True, interpolation='bilinear')
img + inter_img
非常感谢