Fulana
Fulana

Reputation: 57

Plot a RGB point on the imshow

I need to represent a single RGB point in the imshow but I'm not getting it, can anyone help me?

Dados de entrada

R = 1.0
G = 0.7042952754521196
B = 0.019247748523127214

Código

x = np.array([R, G, B])
x.shape = ()
plt.imshow(x)
plt.colorbar()
plt.show()

Upvotes: 1

Views: 443

Answers (1)

cmaureir
cmaureir

Reputation: 285

If you want to plot a RGB color, you were doing it right:

import matplotlib.pyplot as plt
R = 1.0
G = 0.7042952754521196
B = 0.019247748523127214
plt.imshow([[(R, G, B)]])

color plot

Upvotes: 3

Related Questions