numpy - displaying a colored 2d array in matplotlib in Python -
I want to plot 2-D matrix from numpy as a color matrix in Matplotlib. I have 9-B-9 array:
my_array = diag (wal (9)) # conspiracy gangster pcolor (my_array)
I To have a certain color, want to set the first three elements of the diagonal, the next three have a different color, and the last three different colors I want to specify the color by the hex code string, such as "#FF8C00" how can I do this Am I
Also, how can I set the color of 0-valuable elements for pcolor?
To put the elements in different colors, give them different values:
Imported listed matplotlib.colors from Articles, Noon Serial = Listed columns (['# E0E0E0', '# FF8C00', '# 8c00FF', '# 00FF8C']) Panic (my_array , Cmap = cmap, norm = noNorm ())
ideal = any ()
logic matrix avoids any scaling of values, so that in the list The first Color, 1 second, etc.
Comments
Post a Comment