1
matplotlibを使用して、角度の放射体の正弦値と余弦値のワイヤフレームで3Dヒストグラムをプロットします。それが必要としてプロットは、円を形成:Matplotlib 3Dプロットの円内にない値を外す
今、私はちょうど円とその丘は値の円とその周辺のプロットではなく、持ってしようとしています。 私は
hist[hist==0] = np.nan
でゼロであるすべての値を解雇しようとしたが、その後、私のプロットは、円の中にもいくつかの値がゼロであるので、ワイヤフレームプロットはもう「地面に触れ」しない場合、この、のように見えます。
だから、円形にし、その周りが、プロットはまだゼロまでのすべての道を行くという値を却下する方法はありますか?
これは私のコードです:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
cos, sin = np.genfromtxt('out_dhdrls_test0123.csv', delimiter=' ').transpose()
hist, xedges, yedges = np.histogram2d(cos, sin, bins=50, range=[[-1, 1], [-1, 1]])
hist[hist==0] = np.nan
xpos, ypos = np.meshgrid(xedges[:-1], yedges[:-1])
zpos = np.zeros_like(xpos)
ax.set_xlabel('xlabel')
ax.set_ylabel('ylabel')
ax.plot_wireframe(xpos, ypos, hist)
plt.show()