-
Notifications
You must be signed in to change notification settings - Fork 1
/
plots.py
executable file
·28 lines (26 loc) · 1.04 KB
/
plots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from matplotlib import cm
from matplotlib.colors import ListedColormap,LinearSegmentedColormap
import numpy as np
import torch
import matplotlib.pyplot as plt
from config import N_TARGET_NODES,N_SOURCE_NODES
def plot_source (graph):
hsv_modified = cm.get_cmap('twilight', 256) # create new hsv colormaps in range of 0.3 (green) to 0.7 (blue)
newcmp = ListedColormap(hsv_modified(np.linspace(0.55, 0.88, 100000)))
plt.figure()
# trie = np.ma.masked_where(trie == 0, trie)
newcmp.set_bad(color="#631120")
plt.pcolormesh(graph, cmap=newcmp)
plt.ylim(N_SOURCE_NODES, 0)
plt.colorbar()
return plt.show()
def plot_target (graph):
hsv_modified = cm.get_cmap('twilight', 256) # create new hsv colormaps in range of 0.3 (green) to 0.7 (blue)
newcmp = ListedColormap(hsv_modified(np.linspace(0.55, 0.88, 100000)))
plt.figure()
# trie = np.ma.masked_where(trie == 0, trie)
newcmp.set_bad(color="#631120")
plt.pcolormesh(graph, cmap=newcmp)
plt.ylim(N_TARGET_NODES, 0)
plt.colorbar()
return plt.show()