In this notebook, I'm going to test some colors on my spectrometer.
import numpy as np
import matplotlib.pyplot as plt
import skimage.io
from ipywidgets import interact
%matplotlib inline
Let's write a simple function that displays a single color image:
@interact
def draw_uniform_color(r=(0, 255),
g=(0, 255),
b=(0, 255),
alpha=(0, 255)):
"Draws a uniformly colored rectangle."
w, h = 1400, 1200
img = np.ones((h, w, 4), dtype=np.float)
img *= np.array((r, g, b, alpha)) / 255.
plt.figure(figsize=(10, 8))
plt.imshow(img)
plt.axis('off')
plt.show()