Create Hand‑Drawn Style Charts in Python with CuteCharts – Full Guide
This article introduces the Python library CuteCharts, explains how to install it, outlines its common configuration options, and provides detailed code examples and visual demos for Bar, Line, Pie, Radar, and Scatter charts that mimic a hand‑drawn style.
CuteCharts – Hand‑Drawn Style Visualization in Python
Today we introduce a cool Python package for hand‑drawn style visualizations: cutecharts . Unlike common chart libraries such as Matplotlib or pyecharts, this package can generate charts that look hand‑drawn, which may be more suitable in certain scenarios.
GitHub repository: https://github.com/chenjiandongx/cutecharts
Installation
pip install cutechartsOr install from source:
$ git clone https://github.com/chenjiandongx/cutecharts.git
$ cd cutecharts
$ pip install -r requirements.txt
$ python setup.py installCommon Parameters
All chart classes share several methods:
__init__ – Parameters: title (optional str), width (default "800px"), height (default "600px"), assets_host (optional str).
render – Parameters: dest (default "render.html"), template_name (default "basic_local.html").
render_notebook – Parameter: template_type (default "basic").
load_javascript – Loads JS dependencies for JupyterLab rendering.
Bar Chart
cutecharts.charts.Bar
API
set_options(labels, x_label="", y_label="", y_tick_count=3, colors=None, font_family=None) add_series(name, data)Demo
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()Color Adjustment Example
def bar_tickcount_colors():
chart = Bar("Bar‑Color Adjustment")
chart.set_options(labels=Faker.choose(), y_tick_count=10, colors=Faker.colors)
chart.add_series("series-A", Faker.values())
return chartLine Chart
cutecharts.charts.Line
API
set_options(labels, x_label="", y_label="", y_tick_count=3, legend_pos="upLeft", colors=None, font_family=None) add_series(name, data)Demo
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()Legend Position Example
def line_legend():
chart = Line("Line‑Legend Position")
chart.set_options(labels=Faker.choose(), legend_pos="upRight")
chart.add_series("series-A", Faker.values())
chart.add_series("series-B", Faker.values())
return chartColor and Tick Count Example
def line_tickcount_colors():
chart = Line("Line‑Color Adjustment")
chart.set_options(labels=Faker.choose(), colors=Faker.colors, y_tick_count=8)
chart.add_series("series-A", Faker.values())
chart.add_series("series-B", Faker.values())
return chartPie Chart
cutecharts.charts.Pie
API
set_options(labels, inner_radius=0.5, legend_pos="upLeft", colors=None, font_family=None) add_series(data)Demo
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()Legend Font Example
def pie_legend_font():
chart = Pie("Pie‑Legend")
chart.set_options(
labels=Faker.choose(),
legend_pos="downLeft",
font_family='"Times New Roman",Georgia,Serif;'
)
chart.add_series(Faker.values())
return chartRadius Adjustment Example
def pie_radius():
chart = Pie("Pie‑Radius")
chart.set_options(labels=Faker.choose(), inner_radius=0)
chart.add_series(Faker.values())
return chartRadar Chart
cutecharts.charts.Radar
API
set_options(labels, is_show_label=True, is_show_legend=True, tick_count=3, legend_pos="upLeft", colors=None, font_family=None) add_series(name, data)Demo
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()Color Adjustment Example
def radar_legend_colors():
chart = Radar("Radar‑Color Adjustment")
chart.set_options(labels=Faker.choose(), colors=Faker.colors, legend_pos="upRight")
chart.add_series("series-A", Faker.values())
chart.add_series("series-B", Faker.values())
return chartScatter Chart
cutecharts.charts.Scatter
API
set_options(x_label="", y_label="", x_tick_count=3, y_tick_count=3, is_show_line=False, dot_size=1, time_format=None, legend_pos="upLeft", colors=None, font_family=None) add_series(name, data)– data is a list of (x, y) tuples.
Demo
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()Dot Size and Tick Count Example
def scatter_dotsize_tickcount():
chart = Scatter("Scatter‑Dot Size")
chart.set_options(dot_size=2, y_tick_count=8)
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 chartConnecting Dots with Lines Example
def scatter_show_line():
chart = Scatter("Scatter‑Line Connection")
chart.set_options(y_tick_count=8, is_show_line=True)
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 chartSource: GitPython
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
