本文的文字及圖片來源於網絡,僅供學習、交流使用,不具備任何商業用途,版權歸原做者全部,若有問題請及時聯繫咱們以做處理。git
GitHub 地址:https://github.com/chenjiandongx/cutechartsgithub
PS:若有須要Python學習資料的小夥伴能夠加點擊下方連接自行獲取網絡
http://note.youdao.com/noteshare?id=3054cce4add8a909e784ad934f956cefecharts
今天,給你們介紹一個很酷的 Python 手繪風格可視化神包:cutecharts。學習
和 Matplotlib 、pyecharts 等常見的圖表不一樣,使用這個包能夠生成下面這種看起來像手繪的各類圖表,在一些場景下使用效果可能會更好。spa
一行命令先安裝好該庫:3d
pip install cutecharts
1 from cutecharts.charts import Bar 2 from cutecharts.components import Page 3 from cutecharts.faker import Faker 4 5 6 def bar_base() -> Bar: 7 chart = Bar("Bar-基本示例") 8 chart.set_options(labels=Faker.choose(), x_label="I'm xlabel", y_label="I'm ylabel") 9 chart.add_series("series-A", Faker.values()) 10 return chart 11 12 bar_base().render()
1 from cutecharts.charts import Line 2 from cutecharts.components import Page 3 from cutecharts.faker import Faker 4 5 6 def line_base() -> Line: 7 chart = Line("Line-基本示例") 8 chart.set_options(labels=Faker.choose(), x_label="I'm xlabel", y_label="I'm ylabel") 9 chart.add_series("series-A", Faker.values()) 10 chart.add_series("series-B", Faker.values()) 11 return chart 12 line_base().render()
1 from cutecharts.charts import Pie 2 from cutecharts.components import Page 3 from cutecharts.faker import Faker 4 5 6 def pie_base() -> Pie: 7 chart = Pie("Pie-基本示例") 8 chart.set_options(labels=Faker.choose()) 9 chart.add_series(Faker.values()) 10 return chart 11 pie_base().render()
1 from cutecharts.charts import Radar 2 from cutecharts.components import Page 3 from cutecharts.faker import Faker 4 5 6 def radar_base() -> Radar: 7 chart = Radar("Radar-基本示例") 8 chart.set_options(labels=Faker.choose()) 9 chart.add_series("series-A", Faker.values()) 10 chart.add_series("series-B", Faker.values()) 11 return chart 12 13 14 radar_base().render()
1 from cutecharts.charts import Scatter 2 from cutecharts.components import Page 3 from cutecharts.faker import Faker 4 5 6 def scatter_base() -> Scatter: 7 chart = Scatter("Scatter-基本示例") 8 chart.set_options(x_label="I'm xlabel", y_label="I'm ylabel") 9 chart.add_series( 10 "series-A", [(z[0], z[1]) for z in zip(Faker.values(), Faker.values())] 11 ) 12 chart.add_series( 13 "series-B", [(z[0], z[1]) for z in zip(Faker.values(), Faker.values())] 14 ) 15 return chart 16 17 18 scatter_base().render()
以爲不錯就趕忙去嚐嚐鮮!code