我有一个4D情节:
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
x = np.arange(100)/ 101
y = np.sin(x) + np.cos(x)
X,Y = np.meshgrid(x,y)
Z = (X**2) / (Y**2)
A = np.sin(Z)
fig = plt.figure()
ax = fig.add_subplot(111,projection= '3d' )
ax.plot_surface(X,Y, Z, facecolors=cm.Oranges(A))
plt.show()
输出图像
但是如何查看色彩映射的比例?
答案 0 :(得分:-1)
您需要从colormap
创建一个mappableloops
在这个问题的答案中: Matplotlib 3d plot - associate colorbar with different axis