Apr-08-2019, 04:55 PM
I am trying to create to create a list of colors based on the labels contained in the array comms.
How can I do that?
For some reason, the following returns a list of identical colours
import matplotlib.pyplot as plt cmap = plt.get_cmap("tab10") ind = [10 if np.remainder(comms[i],10) == 0 else np.remainder(comms[i],10) for i in range(nx.number_of_nodes(G))]I want to evaluate cmap at ind to obtain an array of colours.
How can I do that?
For some reason, the following returns a list of identical colours
colors = [cmap(10) if np.remainder(comms[i],10) == 0 else cmap(np.remainder(comms[i],10)) for i in range(nx.number_of_nodes(G))]