1
3D 데이터로 히트 맵을 생성하고 싶습니다.matplotlib의 3D 데이터를 사용한 히트 맵
이 데이터를 사용하여 trisurf를 플로팅 할 수있었습니다.
히트 맵을 생성하는 데 도움이 될 수 있습니까? 온라인 자습서를 보았지만 3D 용으로 모두 상당히 복잡해 보입니다. 이 웹 사이트에서 matplotlib에 scatter point가있는 히트 맵을 생성했지만 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라고 말하십시오. 색상이있는 3D scatter plot을 시도했습니다. 그러나 히트 맵을 찾고 있습니다. 당신은 단지 "색상에 대한 3 차원을 사용하고자하는"경우
나는 3D 입방경을 색으로 표시 하겠지만, 데이터에 어떤 구조가 없는지 알 수는 없습니다. 지금까지 코드를 게시하지 않는 것이 좋습니다. – ysakamoto
어떤 종류의 열지도가 필요하십니까? 데이터가 4 차원이고 4 차원으로 색상을 결정하고 싶습니까? 음모가 무엇을 원하는지 질문에서 분명하지 않습니다. –
데이터는 3 차원입니다. 나는 채색을 위해 3 차원을 사용하고 싶다. – Pretty