MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / render_hierarchy

Function render_hierarchy

python/graphvite/application/application.py:1317–1343  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

1315
1316
1317def render_hierarchy(args):
1318 from matplotlib import pyplot as plt
1319 plt.switch_backend("agg")
1320
1321 coordinates, H, Y, sample, figure_size, scale, depth = args
1322
1323 fig = plt.figure(figsize=(figure_size, figure_size))
1324 ax = fig.gca()
1325 if H is not None:
1326 for i in range(len(Y)):
1327 if H[i] != H[sample]:
1328 Y[i] = "else"
1329 classes = set(Y)
1330 classes.discard(Y[sample])
1331 classes.discard("else")
1332 classes = [Y[sample]] + sorted(classes) + ["else"]
1333 for i, cls in enumerate(classes):
1334 indexes, = np.where(Y == cls)
1335 color = "lightgrey" if cls == "else" else None
1336 ax.scatter(*coordinates[indexes].T, s=2, c=color, zorder=-i)
1337 ax.set_xticks([])
1338 ax.set_yticks([])
1339 ax.legend(classes, markerscale=6, loc="upper right")
1340 fig.canvas.draw()
1341 frame = np.asarray(fig.canvas.renderer._renderer)
1342
1343 return frame
1344
1345
1346def render_animation(args):

Callers

nothing calls this directly

Calls 1

scatterMethod · 0.80

Tested by

no test coverage detected