끄적끄적 코딩
article thumbnail
Published 2020. 10. 5. 06:08
[bokeh] 이미지 (Images) bokeh
N = 50
img = np.empty((N, N), dtype=np.uint32)
view = img.view(dtype=np.uint8).reshape((N, N, 4))
for i in range(N):
  for j in range(N):
    view[i, j, 0] = int(127 * i / N)
    view[i, j, 1] = 127
    view[i, j, 2] = int(255 * j / N)
    view[i, j, 3] = 255

p = figure(plot_width=400, plot_height=400,
           x_range=(0, 10), y_range=(0, 10))
p.image_rgba(image=[img], x=[0], y=[0], dw=[10], dh=[10])
show(p)

 

l = np.linspace(0, 20, 400)	#균일한 값 생성
X, Y = np.meshgrid(l, l)    #mesh 그리드 표현
d = np.sin(X) * np.cos(Y)

p = figure(plot_width=400, plot_height=400)
p.x_range.range_padding = p.y_range.range_padding = 0
p.image(image=[d], x=0, y=0, dw=10, dh=10, palette="Viridis11", level="image")
p.grid.grid_line_width = 0.5
show(p)

.

'bokeh' 카테고리의 다른 글

[bokeh] 쐐기, 원호 (Wedges, Arcs)  (0) 2020.10.05
[bokeh] 세그먼트, 광선(Segments, Rays)  (0) 2020.10.05
[bokeh] 계란형 (Ovals)  (0) 2020.10.05
[bokeh] 패치, 폴리곤 (Patch, Polygons)  (0) 2020.10.05
[bokeh] 영역 (Areas)  (0) 2020.10.05

검색 태그