我正在通过模拟在平面和球体上绘制事物。但是,平面和球体的表面没有显示为相同的颜色。这是一个最小的工作示例
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)
x = 100 * np.outer(np.cos(u), np.sin(v))
y = 100 * np.outer(np.sin(u), np.sin(v))
z = 100 * np.outer(np.ones(np.size(u)), np.cos(v))
xx, yy = np.meshgrid(np.linspace(50-40, 50+40, num=5), np.linspace(-40, 40, num=5))
zz = 0*xx
fig = plt.figure(figsize=plt.figaspect(1))
ax=fig.add_subplot(2,1,1, projection='3d')
ax.plot_surface(x, y, z, color='r')
ax.set_xlim3d(-15, 15)
ax.set_ylim3d(-15, 15)
ax.set_zlim3d(90, 120)
ax.view_init(elev=20., azim=-90)
ax.set_axis_off()
ax=fig.add_subplot(2,1,2, projection='3d')
ax.plot_surface(xx, yy, zz, color='r')
ax.set_xlim3d(-15+45, 15+45)
ax.set_ylim3d(-15, 15)
ax.set_zlim3d(-5, 25)
ax.view_init(elev=20., azim=-90)
ax.set_axis_off()
plt.show()
任何想法为什么它不是同一种颜色以及如何使它相同?