Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

python - pyplot: define customised colormap for image plot which assigns a color to a certain value

What is the easiest way to display an array with only very few different values as an image plot, e.g. with imshow from matplotlib.pyplot, assigning fixed colors to each of the values that show up in the array? For instance, if the array contained only the binary values 0 and 1, I would like to be able to draw all value-0-pixels in yellow and all value-1-pixels in green, say. Can this be achieved using a customised colormap or is it necessary to write a new array containing the appropriate rgb tuple for each original value?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...