擅长:python、mysql、java
<p>您可以为散布调整标记的颜色和大小。例如,您可以通过将标记的大小设置为0来过滤掉低于某个阈值的所有标记。也可以使标记的大小与场强度相适应。你知道吗</p>
<p>例如:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
f = lambda x,y,z: np.exp(-(x-3)**2-(y-3)**2-(z-1)**2) - \
np.exp(-(x+3)**2-(y+3)**2-(z+1)**2)
t1 = np.linspace(-6,6,101)
t2 = np.linspace(-3,3,41)
# Data of shape 101,101,41
data = f(*np.meshgrid(t1,t1,t2))
print(data.shape)
# Coordinates
x = np.linspace(1,101,101)
y = np.linspace(1,101,101)
z = np.linspace(1,101,41)
xx,yy,zz = np.meshgrid(x,y,z)
fig=plt.figure()
ax = fig.add_subplot(111, projection='3d')
s = np.abs(data/data.max())**2*25
s[np.abs(data) < 0.05] = 0
ax.scatter(xx, yy, zz, s=s, c=data.flatten(), linewidth=0, cmap="jet", alpha=.5)
plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/30sjg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/30sjg.png" alt="enter image description here"/></a></p>