Skip to content

Instantly share code, notes, and snippets.

@manuel-delverme
Last active August 10, 2016 15:26
Show Gist options
  • Save manuel-delverme/0a4610a981f0f92c1685a74a4fce1feb to your computer and use it in GitHub Desktop.
Save manuel-delverme/0a4610a981f0f92c1685a74a4fce1feb to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
from adjustText import adjust_text
import json
notes = []
together = [(0, 1.0, 0.4), (25, 1.0127692669427917, 0.41), (50, 1.016404709797609, 0.41), (75, 1.1043426359673716, 0.42), (100, 1.1610446924342996, 0.44), (125, 1.1685687930691457, 0.43), (150, 1.3486407784550272, 0.45), (250, 1.4013999168008104, 0.45)]
embed = [(y,y) for (x,y,z) in together]
embed += [(y*1.1,y) for (x,y,z) in together]
embed += [(y,y*1.1) for (x,y,z) in together]
clusters = range(len(embed))
names = [str(a) for a in embed]
for point, label in zip(embed, names):
notes.append(plt.text(point[0], point[1], label, bbox={'pad':0, 'alpha':0}, size=5))
adjust_text(notes, arrowprops=dict(arrowstyle="->", color='r'))
# adrust_text(notes, arrowprops=dict(arrowstyle="-", color='r'))
plt.scatter(*np.transpose(embed), c=clusters)
plt.title("thres %f; clusters: %d" % (1, 2))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment