Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy annotate with three arrows

def my_annotate(ax, s, xy_arr=[], *args, **kwargs):
  ans = []
  an = ax.annotate(s, xy_arr[0], *args, **kwargs)
  ans.append(an)
  d = {}
  try:
    d['xycoords'] = kwargs['xycoords']
  except KeyError:
    pass
  try:
    d['arrowprops'] = kwargs['arrowprops']
  except KeyError:
    pass
  for xy in xy_arr[1:]:
    an = ax.annotate(s, xy, alpha=0.0, xytext=(0,0), textcoords=an, **d)
    ans.append(an)
  return ans

ax = plt.gca()
ax.plot([1,2,3,4],[1,4,2,6])
my_annotate(ax,
            'Test',
            xy_arr=[(2,4), (3,2), (4,6)], xycoords='data',
            xytext=(30, -80), textcoords='offset points',
            bbox=dict(boxstyle='round,pad=0.2', fc='yellow', alpha=0.3),
            arrowprops=dict(arrowstyle="-|>",
                            connectionstyle="arc3,rad=0.2",
                            fc="w"))
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: How to hyperlink image in blender 
Python :: pip img2pdf 
Python :: how to deploy a file size greater than 100mb on pythonanywhere 
Python :: convert excel cellname to index python 
Python :: jwt authentication python flask 
Python :: how to pairwise permute in python 
Python :: drop duplicates pandas considering lowercase 
Python :: qlcdnumber set value python 
Python :: python graphviz undirected graph 
Python :: install formio data python library 
Python :: python3 paramiko read stdout 
Python :: how to i print oin pyhton 
Python :: i for i 
Python :: python draw state diagrams 
Python :: does the queen brush her teeth 
Python :: check if value exists in list python 
Python :: convert c++ code to python 
Python :: resizing windows with background tkinter 
Python :: anaconda pytorch depencies windows 
Python :: Feature Importance 
Python :: discord.py embed length greater than 1024 
Python :: get next iterator without incrementing python 
Python :: How to estimate memory of dataset using python command 
Python :: scikit learn introduction 
Python :: Random Average 
Python :: BeautifulSoup in pretty way 
Python :: bucket dataframe into ranges 
Python :: print function in python 
Python :: save impt 
Python :: how to run matrix in python 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =