В приведенном ниже коде я хотел бы сделать свой график красочным и добавить к нему цветовую шкалу, как в примере 1 ниже. Как мне это сделать? Другими словами, я хочу взять свою трехмерную фигуру и добавить цвет и масштаб, как в примере 1.
Пример 1
Какой у меня токграфик выглядит как
Вот мой код:
import matplotlib as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
from test4 import model_brdf2
#from test4 import theta_i_uniq
#from test4 import theta_r_uniq
#from test4 import phi_r_uniq
def polar2cart(rho,theta,phi):
x = rho* np.sin(theta)*np.cos(phi)
y = rho *np.sin(theta)*np.sin(phi)
z = rho *np.cos(theta)
return(x,y,z)
theta_r_uniq = np.deg2rad(np.linspace(-80,80))
phi_r_uniq = np.deg2rad(np.linspace(-180, 180))
Theta_grid, Phi_grid = np.meshgrid(theta_r_uniq, phi_r_uniq)
nrows, ncols = Theta_grid.shape
#Theta_grid = Theta_grid.flatten()
#Phi_grid = Phi_grid.flatten()
fig = plt.figure()
ax = plt.axes(projection="3d")
theta_i_rad = np.deg2rad(-60.0)
r_brdf = model_brdf2(theta_i_rad,0,Theta_grid,Phi_grid)
Xgrid, Ygrid, Zgrid = polar2cart(r_brdf,Theta_grid, Phi_grid)
#z = np.cos(Theta_grid) #+ np.sin(Phi_grid)
#ax.plot3D(Xgrid, Ygrid, z, )
ax.plot_wireframe(Xgrid, Ygrid, Zgrid)
plt.show()