# matplotlib之arrow

2018/04/13 08:31

## arrow函数

matplotlib.pyplot.arrow(
x, y, dx, dy,
hold=None, **kwargs)


## 参数

x, y : 箭头起点坐标

dx, dy : 箭头x上的长度和y轴上的长度

width: 箭头宽度，默认0.001

shape: [‘full’, ‘left’, ‘right’]，箭头形状， 默认 ‘full’

overhang: float (default: 0)

FancyArrow

## 参数对比实例

# -*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

ax = plt.subplot(331)
ax.arrow(0, 0, 0.5, 0.5, width=0.05)
ax.set_title("0, 0, 0.5, 0.5, width=0.05")

ax = plt.subplot(332)

ax = plt.subplot(333)
ax.arrow(0, 0, 0.5, 0.5, width=0.1)
ax.set_title("0, 0, 0.5, 0.5, width=0.1")

ax = plt.subplot(334)
ax.arrow(0, 0, 0.5, 0.5, width=0.05,shape="left")
ax.set_title("0, 0, 0.5, 0.5, width=0.05,shape=left")

ax = plt.subplot(335)
ax.arrow(0, 0, 0.5, 0.5, width=0.05,shape="right")
ax.set_title("0, 0, 0.5, 0.5, width=0.05,shape=right")

ax = plt.subplot(336)
ax.arrow(0, 0, 0.5, 0.5, width=0.05,overhang=0.5)
ax.set_title("0, 0, 0.5, 0.5, width=0.05,overhang=0.5")

ax = plt.subplot(337)

ax = plt.subplot(338)
ax.arrow(0, 0, 0.5, 0.5, width=0.05,fill=False,ec='red')
ax.set_title("0, 0, 0.5, 0.5, width=0.05,fill=False,ec='red'")

ax = plt.subplot(339)
ax.arrow(0, 0, 0.5, 0.5, width=0.05,fc='red',ec='blue',alpha=0.3)
ax.set_title("0, 0, 0.5, 0.5, width=0.05,fc='red',ec='blue',alpha=0.3")

plt.gcf().set_size_inches(14,12)
plt.savefig('arrow.png')
plt.show()


## 参考

matplotlib.patches.FancyArrow

matplotlib.pyplot.arrow

0
0 收藏

0 评论
0 收藏
0