日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

python三维数据图_matplotlib中三维数据的热图

發布時間:2023/12/1 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python三维数据图_matplotlib中三维数据的热图 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我想用我的三維數據生成一張熱圖。在

我已經能夠用這些數據繪制出trisurf。在

有人能幫我制作熱圖嗎?我看到了在線教程,但是它們對3D來說都很復雜,我在這個網站上找到了一個在matplotlib中生成帶有散點的熱圖,但是它只有2D數據。在

我生成trisurf的代碼是from mpl_toolkits.mplot3d import Axes3D

from matplotlib import cm

import matplotlib.pyplot as plt

import numpy as np

n_angles = 36

n_radii = 8

# An array of radii

# Does not include radius r=0, this is to eliminate duplicate points

radii = np.linspace(0.125, 1.0, n_radii)

# An array of angles

angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)

# Repeat all angles for each radius

angles = np.repeat(angles[...,np.newaxis], n_radii, axis=1)

# Convert polar (radii, angles) coords to cartesian (x, y) coords

# (0, 0) is added here. There are no duplicate points in the (x, y) plane

x,y,z =np.loadtxt('output/flash_KR_endowment_duration_3D.dat',delimiter='\t',usecols=(0,1,2),unpack=True)

#x,y,z =np.loadtxt('output/disk_KR_endowment_duration_3D.dat',delimiter='\t',usecols=(0,1,2),unpack=True)

fig = plt.figure()

ax = fig.gca(projection='3d')

#fig.suptitle(suptitle, fontsize=12, fontweight='bold')

#ax.set_title("Disk Kryder's Rate-Endowment-Duration Plot",fontsize=12)

ax.set_title("Flash Kryder's Rate-Endowment-Duration Plot",fontsize=12)

ax.set_xlabel("Kryder's rate")

ax.set_ylabel("Duration")

ax.set_zlabel("Endowment")

surf = ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2)

fig.colorbar(surf, shrink=.7, aspect=20)

plt.show()

數據為3列。比如說X,Y,Z。我試過用顏色繪制三維散點圖。但我在找熱圖。在

總結

以上是生活随笔為你收集整理的python三维数据图_matplotlib中三维数据的热图的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。