我有非结构化数据,我正在使用trimesh
并尝试在 geoview python 中绘制它,最多只完成颜色条和颜色图不起作用。请帮我做这件事。
数据视图
x[:10]
array([84.0023 , 84.08752 , 83.91598 , 83.93291 , 84.01886 , 84.103714,
84.18686 , 84.271126, 84.35396 , 84.36929 ], dtype=float32)
y[:10]
array([3.2143488, 3.2616525, 3.161731 , 3.245199 , 3.2980833, 3.3457222,
3.3847086, 3.4297318, 3.4661648, 3.5507472], dtype=float32)
z1[:10]
array([2.0012133, 1.9862963, 1.9983754, 2.0019515, 2.0047712, 2.0055804,
1.9985499, 1.9724607, 1.0084723, 1.7957278], dtype=float32)
pts = np.stack((x,y,z)).T
verts = pd.DataFrame(np.stack((x,y,z)).T, columns=['x', 'y' , 'z'])
verts[:10]
x y z1
0 84.002296 3.214349 2.001213
1 84.087517 3.261652 1.986296
2 83.915977 3.161731 1.998375
3 83.932907 3.245199 2.001951
4 84.018860 3.298083 2.004771
5 84.103714 3.345722 2.005580
6 84.186859 3.384709 1.998550
7 84.271126 3.429732 1.972461
8 84.353958 3.466165 1.008472
9 84.369293 3.550747 1.795728
tri_sub[:10]
B C D
0 280486 280494 280485
1 280484 280485 280494
2 280484 280494 280493
3 280483 280484 280493
4 280492 280483 280493
5 280482 280483 280492
6 280491 280482 280492
7 280481 280482 280491
8 280490 280481 280491
9 280480 280481 280490
绘图 z 轴以 RGBA 颜色显示,悬停显示 RGBA 颜色值。
pts = np.stack((x,y,z)).T
# The main code of plotting is given below .
verts = pd.DataFrame(np.stack((x,y,z)).T, columns=['x', 'y' , 'z'])
#cvs = ds.Canvas(plot_height=600,plot_width=600)
%opts WMTS[width=950 height=950]
tiles=gv.WMTS('https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png')
tri_sub = tri_new.apply(lambda x: x - 1)
gg=tiles*datashade(gv.TriMesh((tri_sub,gv.Points(verts, vdims='z'))),
aggregator=ds.mean('z')).opts( cmap='jet', edge_color='z', filled=True,
height=400,
tools=['hover'], width=400)
gv.save(gg,datetostr+"out432.html")
print("End2")
break
我的期望 colormap 、 colorbar 和 hover 应该显示 z 值。