code:
def show_color_bar(rgb, weight):
"""
rgb: 0-1 np.float32, N * 3
weight: rgb ratio, N * 1
"""
weight = weight / weight.sum()
x = np.arange(len(weight))
# print(x, weight)
plt.figure()
plt.bar(x, weight, color=rgb, alpha=1)
plt.show()
if __name__ == "__main__":
rgb = np.random.randint(0, 255, (100, 3)) / 255
weight = np.random.uniform(0, 1, 100)
show_color_bar(rgb, weight)