"pcolormesh" gives me weird result when

Viewed 49

I would like to plot RGB image using pcolormesh. But I only get scaled image although I added Red, Green Blue channels individually.

Am I missing option or something? It looks like pcolormesh normalize the pixel values

---Update--

When I rebuild my code again below, it gives me color like a green monster flipped up-side-down.

import matplotlib.pyplot as plt
import numpy as np
import cv2
from tensorflow.keras.datasets import cifar10

(x_train, y_train), (x_test, y_test) = cifar10.load_data()
 
x_test = x_test.reshape(10000, 32, 32, 3)
x_test = x_test.astype('float32')
x = x_test[i, :]
x = x.reshape(32,32,3)

blue,green,red = cv2.split(x)

print(blue)

plt.figure(figsize=(3,3))
plt.pcolormesh(red)
plt.pcolormesh(green)
plt.pcolormesh(blue)
plt.show()
  

I expect this
enter image description here

But it only gives me this
enter image description here

0 Answers
Related