I am trying to plot data points according to their class labels.
import numpy
import matplotlib as plt
x = numpy.random.uniform(size = [1, 15])
labels = numpy.array([1,2,2,2,2,1,1,2,3,1,3,3,1,1, 3])
plt.plot(x, 'o', c = labels)
When I did the above, Python complained that the color values need to be 0, 1. Then I used
plt.plot(x, 'o', c = labels/max(labels))
There is no error generated. A plot window pops up, but there is nothing in the plot window. I am wondering what is the correct way to define the colors that are according to the data labels?
I am also trying to color nodes according to the class labels. This is done in networkx. A simple example is:
import networkx as nx
G=nx.complete_graph(5)
nx.draw(G, node_col = node_labels)
The array node_labels will be the labels of the 5 vertices. I tried using the same approaches I tried above, but the network always has red nodes.
Any insight will be appreciated. Thanks!