Skip to content

Instantly share code, notes, and snippets.

@habi
Created September 6, 2024 11:40
Show Gist options
  • Save habi/9adf81c05c47917d809d4bea004f0930 to your computer and use it in GitHub Desktop.
Save habi/9adf81c05c47917d809d4bea004f0930 to your computer and use it in GitHub Desktop.
def ourarrow(x, y, linestyle='solid', yaw='left', pitch='up', color='white'):
# usually, the arrow points to the left
horizontaldisplacement = 75
verticaldisplacement = horizontaldisplacement
if 'right' in yaw:
horizontaldisplacement = horizontaldisplacement * -1
if 'down' in pitch:
verticaldisplacement = verticaldisplacement * -1
plt.gca().annotate('', xy=(x, y),
xytext=(x + horizontaldisplacement, y + verticaldisplacement),
arrowprops=dict(arrowstyle = '->',
linestyle=linestyle,
connectionstyle = 'arc3',
color=color))
return
plt.imshow(a)
ourarrow(400,400)
ourarrow(400,400, yaw='right', pitch='down', color='green')
ourarrow(400,400, yaw='left', pitch='down', color='red')
ourarrow(400,400, yaw='right', pitch='up', color='blue')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment