# リスト7.7.1:circleメソッドの例
from bokeh.plotting import figure
p = figure(plot_width=200, plot_height=200)
r = p.circle([0], [0])
print(r)
GlyphRenderer(id='1dc99c83-8ee5-4772-b2e1-abe2d4c0d013', ...)
# リスト7.7.3:図形の設定
from bokeh.io import output_notebook, show
output_notebook()
p = figure(plot_width=200, plot_height=200)
r = p.circle([0], [0])
r.glyph.size = 50
r.glyph.fill_color = "red" # サイズ
r.glyph.fill_alpha = 0.5 # 塗りつぶしの不透明度
r.glyph.line_color = "black" # 枠線の色
r.glyph.line_alpha = 0.5 # 枠線の不透明度
r.glyph.line_width = 3 # 枠線の太さ
r.glyph.line_dash = "dashed" # 枠線の種類
show(p)
# リスト7.7.4:図形の選択
from bokeh.models import Circle, Square
p = figure(
plot_width=200,
plot_height=200,
x_range=(-0.5, 2.5),
y_range=(-0.5, 2.5),
tools=["tap", "save"],
)
r1 = p.circle([0, 1, 2], [0, 1, 2], size=30) # ①
r2 = p.square([0, 2], [2, 0], size=30) # ②
r1.selection_glyph = Circle(fill_color="red")
r1.nonselection_glyph = Circle(fill_color="green")
r2.selection_glyph = Square(fill_color="orange")
r2.nonselection_glyph = Square(fill_color="pink")
show(p)