python 使用matplotlib进行2D和3D地标可视化
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用matplotlib进行2D和3D地标可视化相关的知识,希望对你有一定的参考价值。
# TODO: Make this nice
fig = plt.figure(figsize=plt.figaspect(.5))
ax = fig.add_subplot(1, 2, 1)
ax.imshow(frame)
ax.plot(preds[0:17, 0], preds[0:17, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[17:22, 0], preds[17:22, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[22:27, 0], preds[22:27, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[27:31, 0], preds[27:31, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[31:36, 0], preds[31:36, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[36:42, 0], preds[36:42, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[42:48, 0], preds[42:48, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[48:60, 0], preds[48:60, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.plot(preds[60:68, 0], preds[60:68, 1], marker='o', markersize=6,
linestyle='-', color='w', lw=2)
ax.axis('off')
ax = fig.add_subplot(1, 2, 2, projection='3d')
surf = ax.scatter(preds[:, 0] * 1.2, preds[:, 1], preds[:, 2],
c="cyan",
alpha=1.0, edgecolor='b')
ax.plot3D(preds[:17, 0] * 1.2, preds[:17, 1], preds[:17, 2],
color='blue')
ax.plot3D(preds[17:22, 0] * 1.2, preds[17:22, 1], preds[17:22, 2],
color='blue')
ax.plot3D(preds[22:27, 0] * 1.2, preds[22:27, 1], preds[22:27, 2],
color='blue')
ax.plot3D(preds[27:31, 0] * 1.2, preds[27:31, 1], preds[27:31, 2],
color='blue')
ax.plot3D(preds[31:36, 0] * 1.2, preds[31:36, 1], preds[31:36, 2],
color='blue')
ax.plot3D(preds[36:42, 0] * 1.2, preds[36:42, 1], preds[36:42, 2],
color='blue')
ax.plot3D(preds[42:48, 0] * 1.2, preds[42:48, 1], preds[42:48, 2],
color='blue')
ax.plot3D(preds[48:, 0] * 1.2, preds[48:, 1], preds[48:, 2],
color='blue')
ax.view_init(elev=90., azim=90.)
ax.set_xlim(ax.get_xlim()[::-1])
plt.show()
以上是关于python 使用matplotlib进行2D和3D地标可视化的主要内容,如果未能解决你的问题,请参考以下文章
Matplotlib中的颜色、线条、标记样式汇总
python数据分析006_Python 2D绘图库Matplotlib
来自 x、y、z 值的 matplotlib 2D 图
Python基础17 Matplotlib入门使用
matplotlib浅析
Matplotlib常用绘图示例入门