끄적끄적 코딩
article thumbnail
[bokeh] 축 유형 지정 (Specifying Axis Types)
bokeh 2020. 10. 5. 08:10

범주형 축 (Categorical Axes) factors = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] x = np.random.randint(10, 50, size=10) p = figure(y_range=factors) p.circle(x, factors, size=20, fill_color="lightblue", line_color="royalblue", line_width=2) show(p) 날짜/시간 축 (Datetime Axes) 애플, 구글 주식 데이터를 통한 예제 from bokeh.sampledata.stocks import AAPL, GOOG aapl = pd.DataFrame(AAPL) goog = pd.DataFrame(GOOG) a..

article thumbnail
[bokeh] 범위 지정 (Setting Ranges)
bokeh 2020. 10. 5. 07:58

from bokeh.models import Range1d x = np.random.randn(50) y = np.random.randn(50) p = figure(plot_width=400, plot_height=400) p.x_range = Range1d(-5, 5, bounds=(-10, None))# 왼쪽으로 -10까지 확인가능, 오른쪽으로 제한 없음 p.y_range = Range1d(-5, 5, bounds='auto')# y축 고정 p.circle(x, y, size=10) show(p) .

article thumbnail
[bokeh] 도형 결합 (Combining Multiple Glyphs)
bokeh 2020. 10. 5. 07:34

도형 결합 여러 도형을 결합하기 위해서 원하는 도형 형식으로 정의해주면 됩니다. x = np.random.randn(5) y = np.random.randn(5) p = figure(plot_width=400, plot_height=400) p.circle(x, y, fill_color="white", size = 20) p.asterisk(x, y, fill_color="white", size = 20) p.line(x, y, line_width=2) show(p) .

article thumbnail
[bokeh] 쐐기, 원호 (Wedges, Arcs)
bokeh 2020. 10. 5. 06:43

p = figure(plot_width=400, plot_height=400) p.arc(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5], radius=0.4, start_angle=1, end_angle=6, color="skyblue") show(p) p = figure(plot_width=400, plot_height=400) p.wedge(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5], radius=0.4, start_angle=6, end_angle=1, color="skyblue", alpha=0.5, direction="clock") show(p) p = figure(plot_width=400, plot_height=400) p.annular_wedge(..

article thumbnail
[bokeh] 세그먼트, 광선(Segments, Rays)
bokeh 2020. 10. 5. 06:33

세그먼트 시작 위치(x0, y0)과 끝 위치(x1, y1)를 지정해줘서 사용합니다 p = figure(plot_width=400, plot_height=400) p.segment(x0=[1, 2, 3], y0=[1, 2, 3], x1=[1.5, 2.5, 2.5], y1=[2, 2.5, 4], color="royalblue", line_width=3) show(p) 광선 시작 위치 (x, y), length 길이 설정, angle 각도 설정 해서 사용합니다. p = figure(plot_width=400, plot_height=400) p.ray(x=[10, 20, 30, 40], y=[10, 20, 30, 40], length=50, angle=[15, 45, 60, 30], angle_units="de..

article thumbnail
[bokeh] 이미지 (Images)
bokeh 2020. 10. 5. 06:08

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.linsp..

article thumbnail
[bokeh] 계란형 (Ovals)
bokeh 2020. 10. 5. 05:58

계란형 p = figure(plot_width=400, plot_height=400) p.oval(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5], width=[0.4, 0.3, 0.7, 0.5, 0.6], height=30, color="darkblue", angle=np.pi/2, height_units="screen") show(p) .

article thumbnail
[bokeh] 패치, 폴리곤 (Patch, Polygons)
bokeh 2020. 10. 5. 05:23

단일 패치 (Single Patches) p = figure(plot_width=400, plot_height=400) p.patch([1, 2, 3, 4, 5], [5, 7, 8, 5, 2], alpha=0.5, line_width=1) show(p) 다중 패치 (Multiple Patch) p = figure(plot_width=400, plot_height=400) p.patches([[1, 2, 3], [3, 4, 5, 6]], [[1, 5, 2], [3, 2, 2, 4]], color=["orange", "green"], alpha=[0.5, 0.5], line_width=2) show(p) 폴리곤 (Polygons) p = figure(plot_width=400, plot_height=400)..

검색 태그