在matplotlib 3D散射中将一个点带到前面

时间:2018-05-03 19:15:01

标签: python-2.7 matplotlib scatter3d

我试图在下面的情节中把这颗星带到前面。我试过了zorder,但它不起作用。你有什么建议吗?

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(12,6))

ax = fig.gca(projection='3d')
ax.zaxis.get_major_formatter().set_useOffset(True)
#ax.zaxis.set_rotate_label(False)
#ax.yaxis.set_rotate_label(False)
#ax.xaxis.set_rotate_label(False)

ax.scatter(optim_index[np.argmin(optim_val)][0], optim_index[np.argmin(optim_val)][1], min(optim_val),
           marker = '*', color = 'green', s=100, zorder=10, label = 'Optimal Solution')
ax.scatter(Plist, Vlist, Objlist, marker = '.', color = 'grey',label='Infeasible Solution')
ax.scatter(Feas_P, Feas_V, Objval, marker = '.', color = 'royalblue', label='Feasible Solution')


ax.view_init(30, 40)
ax.set_xlabel('Laser Power (W)', rotation = 6)
ax.set_ylabel('Scan Speed (mm/s)', rotation = -30)
ax.set_zlabel('Objective Value ($)', rotation = 92)
ax.legend(loc='upper center', bbox_to_anchor=(0.7, 0.8),
          fancybox=True, shadow=False, ncol=1, scatterpoints = 1, fontsize=10)

plt.show() # Deactivate me to save the plot
#plt.savefig('ParamOptim.png', format='png') #dpi=900)  #Activate me to save the plot

enter image description here

0 个答案:

没有答案