#!/usr/bin/env python # coding: utf-8 # In[2]: from bokeh.plotting import figure, output_notebook, show output_notebook() p = figure(plot_width=200, plot_height=200) p.line([0, 1, 2], [1, 2, 3], line_width=4) show(p) #線の太さの設定 # In[8]: # 線の色の設定 p = figure(plot_width=200, plot_height=200) p.line([0, 1, 2], [1, 2, 3], line_color='red') p.line([0.5, 1, 1.5], [1, 2, 3], line_width=4, line_color='brown') show(p) # In[9]: # 線の不透明度の設定 p = figure(plot_width=200, plot_height=200, y_range=(0.5, 3.5)) p.line([0, 1], [3, 3], line_color='green', line_width=30) p.line([0, 1], [2, 2], line_alpha=0.6, line_color='green', line_width=30) p.line([0, 1], [1, 1], line_color=(0, 255, 0, 0.4), line_width=30 ) show(p) # In[10]: # 線の結合店を設定 p = figure(plot_width=200, plot_height=200, x_range=(0, 2)) for y, line in enumerate(['bevel', 'round', 'miter']): p.line([0, 1, 0], [y, y + 0.5, y + 1], line_width=10, line_join=line) p.text(1.5, y + 0.5, text=[line], text_align='center') show(p) # In[11]: # 線の先端の設定 p = figure(plot_width=200, plot_height=200, x_range=[-0.5, 2.5], y_range=[-0.5, 2.5]) for y, line in enumerate(['square', 'round', 'butt']): p.line([0, 1], [y, y ], line_width=20, line_cap=line) p.text(2, y, text=[line], text_align='center') show(p) # In[12]: # 線の種類の設定1 p = figure(plot_width=200, plot_height=200, y_range=[-0.5, 5]) line_styles = ['solid', 'dashed', 'dotted', 'dotdash', 'dashdot'] for y, line_style in enumerate(line_styles): p.line([0, 1], [y, y ], line_dash=line_style) p.text(0, y, text=[line_style]) show(p) # In[13]: # 線の種類の設定2 p = figure(plot_width=200, plot_height=200) p.line([0, 1], [1, 1], line_dash=(10, 2), line_width=5) show(p) # In[14]: #線の種類の設定 p = figure(plot_width=200, plot_height=200, x_range=(-0.5, 1.5)) p.line([0, 1], [3, 3], line_dash=(20, 5), line_width=5) p.line([0, 1], [2, 2], line_dash=(20, 5), line_dash_offset=(-5), line_width=5) p.line([0, 1], [1, 1], line_dash=(20, 2), line_dash_offset=(5), line_width=5) show(p) # In[ ]: