Create Hand‑Drawn Style Charts in Python with CuteCharts

This article introduces the cutecharts Python library that generates hand‑drawn style visualizations, explains how to install it, describes common chart parameters, and provides detailed API references and code demos for Bar, Line, Pie, Radar, and Scatter charts, complete with example images.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Create Hand‑Drawn Style Charts in Python with CuteCharts

Today we introduce a cool Python hand‑drawn style visualization package: cutecharts . Unlike Matplotlib or pyecharts, cutecharts produces charts that look hand‑sketched, which can be more suitable for certain scenarios.

GitHub repository: https://github.com/chenjiandongx/cutecharts

Install the library with a single command: pip install cutecharts Or install from source:

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

Common Parameters

All charts share some common initialization arguments:

Params                                 Desc
------                                 ----
title: Optional[str] = None            Chart title
width: str = "800px"                  Chart width
height: str = "600px"                 Chart height
assets_host: Optional[str] = None      Resource host

Additional methods:

render(dest: str = "render.html", template_name: str = "basic_local.html")
render_notebook(template_type: str = "basic")
load_javascript()  # Load JS dependencies for JupyterLab

Bar Chart

cutecharts.charts.Bar

API

cutecharts.charts.Bar.set_options
Params                                 Desc
------                                 ----
labels: Iterable                       X‑axis label data
x_label: str = ""                     X‑axis name
y_label: str = ""                     Y‑axis name
y_tick_count: int = 3                 Y‑axis tick count
colors: Optional[Iterable] = None      Label colors
font_family: Optional[str] = None      CSS font‑family
cutecharts.charts.Bar.add_series
Params                                 Desc
------                                 ----
name: str                              Series name
data: Iterable                         Series data list

Demo

Bar‑basic example
from cutecharts.charts import Bar
from cutecharts.components import Page
from cutecharts.faker import Faker

def bar_base() -> Bar:
    chart = Bar("Bar‑basic example")
    chart.set_options(labels=Faker.choose(), x_label="I'm xlabel", y_label="I'm ylabel")
    chart.add_series("series-A", Faker.values())
    return chart

bar_base().render()

Line Chart

cutecharts.charts.Line

API

cutecharts.charts.Line.set_options
Params                                 Desc
------                                 ----
labels: Iterable                       X‑axis label data
x_label: str = ""                     X‑axis name
y_label: str = ""                     Y‑axis name
y_tick_count: int = 3                 Y‑axis tick count
legend_pos: str = "upLeft"            Legend position (upLeft, upRight, downLeft, downRight)
colors: Optional[Iterable] = None      Label colors
font_family: Optional[str] = None      CSS font‑family
cutecharts.charts.Line.add_series
Params                                 Desc
------                                 ----
name: str                              Series name
data: Iterable                         Series data list

Demo

Line‑basic example
from cutecharts.charts import Line
from cutecharts.components import Page
from cutecharts.faker import Faker

def line_base() -> Line:
    chart = Line("Line‑basic example")
    chart.set_options(labels=Faker.choose(), x_label="I'm xlabel", y_label="I'm ylabel")
    chart.add_series("series-A", Faker.values())
    chart.add_series("series-B", Faker.values())
    return chart

line_base().render()

Pie Chart

cutecharts.charts.Pie

API

cutecharts.charts.Pie.set_options
Params                                 Desc
------                                 ----
labels: Iterable                       Data label list
inner_radius: float = 0.5             Inner radius of the pie
legend_pos: str = "upLeft"            Legend position (upLeft, upRight, downLeft, downRight)
colors: Optional[Iterable] = None      Label colors
font_family: Optional[str] = None      CSS font‑family
cutecharts.charts.Pie.add_series
Params                                 Desc
------                                 ----
data: Iterable                         Series data list

Demo

Pie‑basic example
from cutecharts.charts import Pie
from cutecharts.components import Page
from cutecharts.faker import Faker

def pie_base() -> Pie:
    chart = Pie("Pie‑basic example")
    chart.set_options(labels=Faker.choose())
    chart.add_series(Faker.values())
    return chart

pie_base().render()

Radar Chart

cutecharts.charts.Radar

API

cutecharts.charts.Radar.set_options
Params                                 Desc
------                                 ----
labels: Iterable                       Data label list
is_show_label: bool = True            Show labels
is_show_legend: bool = True           Show legend
tick_count: int = 3                   Coordinate tick count
legend_pos: str = "upLeft"            Legend position (upLeft, upRight, downLeft, downRight)
colors: Optional[Iterable] = None      Label colors
font_family: Optional[str] = None      CSS font‑family
cutecharts.charts.Radar.add_series
Params                                 Desc
------                                 ----
name: str                              Series name
data: Iterable                         Series data list

Demo

Radar‑basic example
from cutecharts.charts import Radar
from cutecharts.components import Page
from cutecharts.faker import Faker

def radar_base() -> Radar:
    chart = Radar("Radar‑basic example")
    chart.set_options(labels=Faker.choose())
    chart.add_series("series-A", Faker.values())
    chart.add_series("series-B", Faker.values())
    return chart

radar_base().render()

Scatter Chart

cutecharts.charts.Scatter

API

cutecharts.charts.Scatter.set_options
Params                                 Desc
------                                 ----
x_label: str = ""                     X‑axis name
y_label: str = ""                     Y‑axis name
x_tick_count: int = 3                 X‑axis tick count
y_tick_count: int = 3                 Y‑axis tick count
is_show_line: bool = False            Connect points with a line
dot_size: int = 1                     Size of each dot
time_format: Optional[str] = None    Date format
legend_pos: str = "upLeft"            Legend position (upLeft, upRight, downLeft, downRight)
colors: Optional[Iterable] = None      Label colors
font_family: Optional[str] = None      CSS font‑family
cutecharts.charts.Scatter.add_series
Params                                 Desc
------                                 ----
name: str                              Series name
data: Iterable                         Series data list, [(x1, y1), (x2, y2)]

Demo

Scatter‑basic example
from cutecharts.charts import Scatter
from cutecharts.components import Page
from cutecharts.faker import Faker

def scatter_base() -> Scatter:
    chart = Scatter("Scatter‑basic example")
    chart.set_options(x_label="I'm xlabel", y_label="I'm ylabel")
    chart.add_series(
        "series-A",
        [(z[0], z[1]) for z in zip(Faker.values(), Faker.values())]
    )
    chart.add_series(
        "series-B",
        [(z[0], z[1]) for z in zip(Faker.values(), Faker.values())]
    )
    return chart

scatter_base().render()
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonData visualizationChart LibraryCuteChartshand-drawn charts
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.