Created
September 6, 2024 11:40
-
-
Save habi/9adf81c05c47917d809d4bea004f0930 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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