Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use pyplot.arrow or patches.Arrow in matplotlib?

Tags:

matplotlib

If I wanted to draw arrows instead of axis lines using one of the arrow/Arrow functions, how do I get the line/arrowhead to show up? Example below:

import matplotlib.pyplot as plt
import matplotlib.patches as pts

plt.ion()
ax = plt.axes()
ax.set(xlim=[0,1],ylim=[0,1],autoscale_on=False,clip_on=False)
ax.set(frame_on=False,xticks=[],yticks=[])
pts.Arrow(0,0,1,0,width=0.05)
plt.arrow(0,0,0,1,shape='right',lw=3,fill=True)
ax.text(1,0,'functionalization',
        verticalalignment='top',
        horizontalalignment='center')
ax.text(0,1,'void space/structure')
plt.draw()

pts.Arrow draws nothing, and plt.arrow draws a line but no arrowhead.

like image 474
hatmatrix Avatar asked Oct 30 '11 20:10

hatmatrix


People also ask

What is Matplotlib patches in Python?

The matplotlib. patches. Rectangle class is used to rectangle patch to a plot with lower left at xy = (x, y) with specified width, height and rotation angle.


1 Answers

plt.arrow(0,0,0,1, shape='full', lw=3, length_includes_head=True, head_width=.01)
like image 180
cyborg Avatar answered Sep 22 '22 17:09

cyborg