📉 Hand drawing style charts library for Python

Project address: github.com/chenjiandon…

📣 purpose

While wandering around Github, I found an interesting chart library, Chart.xkcd, which has lovely hand-drawn charts. So there was an idea to combine Chart.xkcd with Python, which eventually became the Cutecharts you see today.

Chart.xkcd has far fewer chart types than Echarts and supports only a few basic charts without many configuration items. Pyecharts may be a better choice if you want to use richer charts. My personal idea for Cutecharts is as a project to learn how to combine Javascript with Python/Notebook. There’s no denying that the JS library has a natural advantage in interactivity and animation, and combining that advantage with the Notebook environment can lead to a lot of interesting projects.

The cutecharts project structure is basically the same as Pyecharts and has all the core functions of Pyecharts. But the whole thing is smaller and the code is more streamlined. If you read through the Cutecharts code and then look at the Pyecharts code, you’ll probably find that there’s really nothing mysterious about it. Hopefully the Python community will have more excellent third-party libraries that combine JS with Python/Notebook. Cutecharts are much more valuable to learn than to use.

🔰 installation

PIP install

$ pip(3) install cutecharts
Copy the code

The source code to install

$ git clone https://github.com/chenjiandongx/cutecharts.git
$ cd cutecharts
$ pip install -r requirements.txt
$ python setup.py install
Copy the code

📝 use

  • Chart documentation: docs/charts.md
  • Component documentation: docs/components.md

The local environment

Generate HTML

from cutecharts.charts import Line


chart = Bar("Sales at a department store")
chart.set_options(
    labels=["Shirt"."Sweater"."Tie"."Pants"."Trench coat"."High heels"."Socks"], 
    x_label="I'm xlabel", 
    y_label="I'm ylabel",
)
chart.add_series("series-A"[57.134.137.129.145.60.49])
chart.add_series("series-B"[114.55.27.101.125.27.105])
chart.render()
Copy the code

The render method generates a render. HTML file locally and opens it in a browser.

Notebook environment

Jupyter Notebook

🔖 Demo