python - 在 imshow 上绘制 RGB 点

标签 python python-3.x matplotlib imshow

我需要在 imshow 中表示单个 RGB 点,但我不明白,有人可以帮助我吗?

Dados de entrada

R = 1.0
G = 0.7042952754521196
B = 0.019247748523127214

科迪戈

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

最佳答案

如果你想绘制 RGB 颜色,那么你做对了:

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

color plot

关于python - 在 imshow 上绘制 RGB 点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54630934/

相关文章:

python - Matplotlib 颜色条在左侧/对侧打勾

python - 作用域如何与 Python 中的 try 和 except block 一起使用?

python - 如何在数据框中存储的一系列数字中找到所有可能的女儿

Python 无法定位 gmpy 库

python - 修复 python 中的重叠图形

python - 使用 numpy 和 scipy 将数组转换为标量

Python matplotlib : Error while saving scatter plot in svg format

python - 如何在 QWidget 中跟踪 matplot Canvas 上的鼠标?

python - 使用 pyserial 处理 com 端口时出现错误

python-3.x - 数据帧错误 : UndefinedVariableError: name is not defined