〇サンプルコード
%matplotlib inline
import pandas as pd
import pygal as pg
from pygal.style import Style
style1 = Style(
colors=('#3060ff', '#ff0000', '#00ff00')
)
chart = pg.HorizontalBar(height=300, style=style1)
df = pd.DataFrame({'商品A': [10], '商品B':[21], '商品C':[32]})
chart.x_labels = ['Sales']
chart.add('商品A', df['商品A'])
chart.add('商品B', df['商品B'])
chart.add('商品C', df['商品C'])
display({'image/svg+xml': chart.render(is_unicode=True)}, raw=True)
○出力画像
〇関連項目
VagrantでJupyter Lab、Pygalをインストールした仮想マシン(Ubuntu18.04)を構築する
http://serverarekore.blogspot.com/2019/03/vagrantjupyter-labpygalubuntu1804.html
VagrantでJupyter Lab、Pygalをインストールした仮想マシン(Debian Stretch/9.6)を構築する
http://serverarekore.blogspot.com/2019/03/vagrantjupyter-labpygaldebian-stretch96.html

No comments:
Post a Comment