Custom colormap: red (0) -> yellow (0.5) -> green (1).
(x)
| 13 | |
| 14 | |
| 15 | def cm_RdGn(x): |
| 16 | """Custom colormap: red (0) -> yellow (0.5) -> green (1).""" |
| 17 | x = np.clip(x, 0, 1)[..., None]*2 |
| 18 | c = x*np.array([[0, 1., 0]]) + (2-x)*np.array([[1., 0, 0]]) |
| 19 | return np.clip(c, 0, 1) |
| 20 | |
| 21 | |
| 22 | def plot_images(imgs, titles=None, cmaps='gray', dpi=100, pad=.5, |
no outgoing calls
no test coverage detected