Changeset 609
- Timestamp:
- 09/02/16 00:06:41 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mds-and-trees/mds_plot.py
r608 r609 118 118 points = [add_jitter(coordinates[:, i]) for i in range(x_dim)] 119 119 120 if labels is not None and dimensions==2: 121 ax.scatter(*points, alpha=0 .1) #barely visible points, because we will show labels anyway120 if labels is not None and dimensions==2: #could be ported to 3D too 121 ax.scatter(*points, alpha=0) #invisible points, because we will show labels instead 122 122 labelconvert={'velland':'V','velwat':'W','vpp':'P','vpa':'A'} #use this if you want to replace long names with short IDs 123 colors={'velland':'green','velwat':'blue','vpp':'red','vpa':'violet'} 123 124 #for point in points: 124 125 # print(point) 125 126 for label, x, y in zip(labels, points[0], points[1]): 127 color='black' 126 128 for key in labelconvert: 127 129 if label.startswith(key): 128 130 label=labelconvert[key] 131 color=colors[key] 129 132 plt.annotate( 130 133 label, 131 134 xy = (x, y), xytext = (0, 0), 132 135 textcoords = 'offset points', ha = 'center', va = 'center', 136 color = color, 137 alpha = 0.8, 133 138 #bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5), 134 139 #arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0')
Note: See TracChangeset
for help on using the changeset viewer.