LoginSignup
0
1

More than 3 years have passed since last update.

グラフ描画ライブラリBokehの使い方

Posted at

・ツールチップでデータの中身を確認することが可能

import matplotlib.pyplot as plt
import numpy as np
import random

from bokeh.io import output_notebook, show
from bokeh.plotting import figure,show
output_notebook()

x = np.linspace(1, 10, 10)
y = [random.randint(0, 10) for i in range(10)]

TOOLTIPS = [
    ("index", "$index"),
    ("(x,y)", "($x, $y)"),
]

#グラフ設定
p = figure(tooltips=TOOLTIPS, title="グラフタイトル", x_axis_label="x軸", y_axis_label="y軸")
# 散布図
p.circle(x = x,y = y)
#show(p)

# 折れ線グラフ
#p.line(x = x,y = y)
#show(p)

# 棒グラフ
#p.vbar(x = x,top = y,width=0.5)
show(p)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1