Use this notebook to obtain "expected" values for
test_geom_imshow_alpha.py
test suite.
import numpy as np
from lets_plot import *
LetsPlot.setup_html()
LetsPlot.set_theme(flavor_solarized_light())
arr = np.array([
[50, 150, 200],
[200, 100, 50]
])
ggplot() + geom_imshow(arr, alpha=.5)
# 'norm' = False
ggplot() + geom_imshow(arr, norm=False, alpha=.5)
# With NaN-s
arr_nan = np.array([
[50., np.nan, 200.],
[np.nan, 100., 50.]
])
ggplot() + geom_imshow(arr_nan, alpha=0.5)
ggplot() + geom_imshow(arr, cmap="magma", alpha=0.5)
# With NaN-s
arr_nan = np.array([
[50., np.nan, 200.],
[np.nan, 100., 50.]
])
ggplot() + geom_imshow(arr_nan, cmap="magma", alpha=0.5)
# RGB image
A2x3x3 = np.array([
[[255, 0, 0], [0, 255, 0], [0, 0, 255]],
[[0, 255, 0], [0, 0, 255], [255, 0, 0]]
])
ggplot() + geom_imshow(A2x3x3)
ggplot() + geom_imshow(A2x3x3, alpha=0.5)
# RGBA image (with alpha channel)
A2x3x4 = np.array([
[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]],
[[0, 1, 0, 0.3], [0, 0, 1, 0.3], [1, 0, 0, 0.3]]
])
ggplot() + geom_imshow(A2x3x4)
ggplot() + geom_imshow(A2x3x4, alpha=0.5)
_.as_dict()