【问题标题】:Multiple independent lines in the same 3D Axes同一 3D 轴中的多条独立线
【发布时间】:2017-07-30 03:26:09
【问题描述】:

我想在 Python 的 3D 图中绘制多条独立的线。它看起来像:。

我是 Python 新手。你能帮帮我吗?

【问题讨论】:

标签: python matplotlib axes mplot3d


【解决方案1】:

您必须使用 matplotlib 库(mplot3d 包)。

这是一个带有线条的 3dr 绘图的小例子:

import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

# make 3d axes
fig = plt.figure()
ax = fig.gca(projection='3d')

# test data
x = np.arange(-1., 1., .1)
y = np.arange(-1., 1., .1)
z1 = x + y
z2 = x * x
z3 = -y * y

# plot test data
ax.plot(x, y, z1)
ax.plot(x, y, z2)
ax.plot(x, y, z3)

# make labels
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')

plt.show()

【讨论】:

  • 非常感谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-30
相关资源
最近更新 更多