【问题标题】:Matplotlib Quiver with Negative Directions带有负方向的 Matplotlib 箭袋
【发布时间】:2017-06-26 14:51:30
【问题描述】:

我正在尝试使用来自matplotlibquiver 绘制向量 (3,2) 和 (4,-1)。但是,下面的代码

import matplotlib.pyplot as plt

X = (0, 0)
Y = (0, 0)
U = (3, 4)
V = (2, -1)

fig, ax = plt.subplots()
ax.quiver( X, Y, U, V, angles='xy', scale_units='xy', scale=1 )
ax.set_xlim( [ -5, 5 ] )
ax.set_ylim( [ -5, 5 ] )
plt.show()

生成以下图:

(4,-1) 向量被绘制为 (-4,-1),但 (3,2) 向量是正确的。发生了什么,如何解决?

【问题讨论】:

    标签: python matplotlib


    【解决方案1】:

    当我在我的系统上运行您的代码时(Spyder 3.1.4 中的 Python 3.6.1 在 IPython 5.3.0 控制台或在 Windows 10 Creators Update 上运行的 Python 控制台中使用 matplotlib 2.0.2)我没有得到您显示的图表。我明白了

    我相信这就是你要找的东西。您可能有一个版本的 matplotlib 或其他有错误的软件。尝试升级到最新版本,然后重试。

    【讨论】:

    • Matplotlib v. 2.0.0 修复了它。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2017-03-17
    • 1970-01-01
    • 1970-01-01
    • 2020-04-14
    • 2017-10-31
    • 1970-01-01
    • 2012-12-06
    • 1970-01-01
    相关资源
    最近更新 更多