python-2.7 - 在 matplotlib 3D scatter 中将一点放在前面
问题描述
我试图在下面的情节中把明星带到前面。我试过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
解决方案
推荐阅读
- node.js - 如何使用 Node.js 为 Google 服务帐户创建 JWT?
- powershell - PowerShell 执行策略集,但从 .Net 程序调用时无法识别
- excel - 从excel中的字符串中“减去”字符串
- c++ - 可变模板参数的模板类型数组
- tensorflow - 空间金字塔池 - 输入大小错误(? - 无)
- r - XGBoost 中节点中的观察数
- azure - 限制对特定组的应用程序注册访问
- java - 交换双二维数组java的行
- python - 处理输入 Excel 文件并序列化其行
- google-maps - 如果我达到免费 api 限制,我可以停止谷歌向我收费吗