user308827
user308827

Reputation: 21981

Draw arrow outside plot in Matplotlib

I have the following gridded plot, and would like to draw an arrow (shown in blue using MS paint). How can I do it through matplotlib? I do not know of any command to do it.

enter image description here

Upvotes: 23

Views: 14533

Answers (2)

Flo
Flo

Reputation: 179

Use clip_on = False in ax.arrow

Upvotes: 17

Dietrich
Dietrich

Reputation: 5531

import matplotlib.pyplot as plt

fg = plt.figure(1);
fg.clf();
ax = fg.add_subplot(1,1,1)
ax.annotate('', xy=(0, -0.1), xycoords='axes fraction', xytext=(1, -0.1), 
            arrowprops=dict(arrowstyle="<->", color='b'))
ax.grid(True)
fg.canvas.draw()

gives enter image description here

Upvotes: 26

Related Questions