python - matplotlib中箭头的位置
问题描述
以下代码从中心向某些点绘制箭头。但是,如您所见,箭头的位置在该点之后。我想把它放在重点之前。我该如何解决。
import matplotlib.pyplot as plt
import numpy as np
a = np.array([
[-0.108,0.414],
[0.755,-0.152],
],)
x, y = a.T
plt.scatter(x, y)
plt.xlim(-1,1)
plt.ylim(-1,1)
ax = plt.axes()
ax.arrow(0, 0, a[0,0], a[0,1], head_width=0.05, head_length=0.1, fc='k', ec='k')
ax.arrow(0, 0, a[1,0], a[1,1], head_width=0.05, head_length=0.1, fc='k', ec='k')
plt.grid(True)
plt.show()
解决方案
推荐阅读
- reactjs - React 变量样式名称
- javascript - 我的 Axios api 调用检索数据的速度不够快
- javascript - 模拟模块仅在描述语句之外工作
- javascript - 有没有办法在 node.js 中同步读取 CSV?
- haxe - Haxe 中的局部常量 - 可能
- go - 什么是处理错误的 Go 模式
- angular - 当 reducer 在 app.module.ts 中有界时,状态和有效负载未定义
- python - 如何提高 Tesseract 的输出
- sql-server - MS SQL Server 的 JOIN 问题
- python - 如何在 Visual Studio 代码中内置运行 python tox 命令和测试