끄적끄적 코딩
article thumbnail
[bokeh] 영역 (Areas)
bokeh 2020. 10. 5. 05:04

단일 영역 (Single Areas) 1. x좌표 2, y범위 1 ~ 7 2. x좌표 4, y범위 4 ~ -1 3. x좌표 6, y범위 5 ~ -3 1번 범위에서 2번 3의 선을 이어서 사이에 있는 영역을 표현합니다 p = figure(plot_width=400, plot_height=400) p.varea(x=[2, 4, 6],#vertical y1=[1, 4, 5], y2=[7, -1, -3]) show(p) 스택 영역 (Stacked Areas) y1의 값 위에 y2의 값이 스택처럼 쌓인것을 확인할 수 있습니다 source = ColumnDataSource(data=dict( x=np.arange(3), y1=[1, 3, 7], y2=[2, 3, 6]) ) p = figure(plot_width=4..

article thumbnail
[bokeh] 막대, 사각형, 육각 타일
bokeh 2020. 10. 4. 11:37

막대, 사각형, 육각타일 (Bar, Rectangle, Hex Tiles) 막대 (Bar) - vbar p = figure(plot_width=400, plot_height=400) p.vbar(x=[1, 2, 3, 4, 5], width=0.5, bottom=0, # vertical bar, 막대 너비 0.5, 최소 값 = 0 top=[1.2, 2.1, 3.3, 2.9, 1.8], color="darkblue") # top = y축 값 show(p) - hbar p = figure(plot_width=400, plot_height=400) p.hbar(y=[1, 2, 3, 4, 5], height=0.5, left=0, # horizontal bar, 막대 너비 0.5, left - 최소값 0 righ..

article thumbnail
[bokeh] 라인 플롯 (Line Plots)
bokeh 2020. 10. 4. 09:13

라인 플롯 - 선을 그리는 시각화 모양 단일 플롯 (Single Lines) x = np.arange(100) # 0 ~ 99 y = np.random.randn(100).cumsum() # cumsum - 누적합 p = figure(plot_width=400, plot_height=400) # 400 * 400 p.line(x, y, line_width=2) # line - x축은 x값, y축은 y값, line길이 2 show(p) p = figure(plot_width=400, plot_height=400) p.line(x, y, line_width=2, line_dash="dotted") # line을 점선 형태로 show(p) p = figure(plot_width=400, plot_height=..

article thumbnail
[bokeh] 산점도(Scatter Plots)
bokeh 2020. 10. 3. 08:45

x() - x 모양 cross() - +모양 asterisk() - * 모양 circle() - O 모양 circle_cross() - O, + 모양 circle_x() - O, x 모양 triangle -△ 모양 inverted_triangle - ▽ 모양 square() - ㅁ 모양 square_cross() - ㅁ, + 모양 square_x() - ㅁ, x 모양 diamond() - ◇ 모양 diamond_cross() - ◇, + 모양 hex() - 육각형 모양 x, y에 랜덤값 10개를 입력 sz 10~40 사이의 랜덤 값으로 설정 x = np.random.randn(10)# x에 랜덤 값 10개 y = np.random.randn(10) # y에 랜덤 값 10개 sz = np.random.ra..

[bokeh] 초기설정
bokeh 2020. 10. 3. 08:03

먼저 다양한 데이터를 다루기위해서 기본이 되는 numpy, pandas를 import합니다. 그리고 기본으로 사용 될 output_notebook, show, figure도 import 해줍니다. notebook환경에서 output을 확인할 것이므로 output_notebook() 선언합니다. import numpy as np import pandas as pd from bokeh.io import output_notebook, show from bokeh.plotting import figure, show output_notebook() output_notebook - notebook환경에서 내용을 출력 show - figure를 출력할 때 사용 figure - 차트나 그래프 등을 그리기 위한 판 예제..

article thumbnail
[bokeh] colab 환경
bokeh 2020. 10. 3. 07:41

다음 코드를 통해서 설치를 하였습니다. pip install bokeh colab notebook 환경에서 bokeh를 사용해보았습니다. colab.research.google.com/notebooks/intro.ipynb Google Colaboratory colab.research.google.com 접속하면 다음과 같은 화면이 나옵니다. FIle - New notebook을 클릭합니다. 그러면 새로운 notebook이 생성됩니다. 밑에 입력창이 있는데 이를 하나의 paragraph라고 합니다 이 부분에 코드를 입력하고 실행하면 해당 paragraph 부분의 내용만 실행이 됩니다. 그리고 각 paragraph끼리의 context가 공유가 됩니다. 다음에는 colab에서 bokeh를 이용한 여러 예제를..

article thumbnail
[bokeh] bokeh란?
bokeh 2020. 10. 3. 07:11

bokeh란? interactive한 시각화 라이브러리 특징 최신 브라우저의 인터랙티브 시각화 독립형 HTML 문서 또는 서버 운영할 수 있도록 지원 표현력이 뛰어나고 다양한 그래픽 지원 큰 동적 데이터 또는 스트리밍 데이터 지원 대표적 언어로 파이썬, Scala, R에서 쉽게 사용 자바스크립트 불필요 bokeh를 이용한 시각화 예 bokeh 공식 홈페이지 : bokeh.org/ Bokeh Visualize Streaming Data Whether you are streaming data from financial markets, IOT telemetry, or physical sensors, Bokeh has efficient streaming APIs to help you keep on top of ..

검색 태그