python单行箭头_在Python中,如何让箭头尖在指定的坐标处开始/结束?
我試圖使用matplotlib的注釋繪制兩端帶有箭頭的直線。但當我繪制它們時,箭頭的尖端并沒有在圖中所示的指定坐標處開始或結束。提示應該從0.6和0.8開始和結束,但它們不是。在
可復制代碼import matplotlib.pyplot as plt
fig = plt.figure(figsize = (5, 5))
plt = plt.subplot(111)
plt.axvline(0.6)
plt.axvline(0.8)
plt.axhline(0.6)
plt.axhline(0.8)
plt.annotate('', xy = (0.6, 0.33), xycoords = 'axes fraction', \
xytext = (0.8, 0.33), textcoords = 'axes fraction', fontsize = 7, \
color = '#303030', arrowprops=dict(edgecolor='black', arrowstyle = ''))
plt.annotate('', xy = (0.33, 0.6), xycoords = 'axes fraction', \
xytext = (0.33, 0.8), textcoords = 'axes fraction', fontsize = 7, \
color = '#303030', arrowprops=dict(edgecolor='black', arrowstyle = ''))
fig.savefig('arrow_head.pdf')
為什么會這樣?如何讓提示在各自的坐標處開始或結束?
總結
以上是生活随笔為你收集整理的python单行箭头_在Python中,如何让箭头尖在指定的坐标处开始/结束?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 服务器被一堆系统登录_WIN10做天高服
- 下一篇: sql 账号查询一个表勾选那个权限_Sp