A basic line plot connects data points with straight lines to show how a continuous variable changes over a sequence or time. It's ideal for revealing trends, patterns, and changes in data over ordered intervals. The simplicity of a single-line design makes it easy to interpret at a glance.

""" anyplot.ai
line-basic: Basic Line Plot
Library: pygal 3.1.0 | Python 3.13.13
Quality: 84/100 | Updated: 2026-04-29
"""
import os
import sys
# Pop script directory so local pygal.py doesn't shadow the installed package
_script_dir = sys.path.pop(0)
import pygal
from pygal.style import Style
sys.path.insert(0, _script_dir)
THEME = os.getenv("ANYPLOT_THEME", "light")
PAGE_BG = "#FAF8F1" if THEME == "light" else "#1A1A17"
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
INK_MUTED = "#6B6A63" if THEME == "light" else "#A8A79F"
IMPRINT = ("#009E73", "#C475FD", "#4467A3", "#BD8233", "#AE3030", "#2ABCCD", "#954477")
# Data
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
temperatures = [2.3, 3.5, 7.2, 11.8, 16.4, 19.8, 22.1, 21.5, 17.6, 12.3, 7.1, 3.4]
# Style
custom_style = Style(
background=PAGE_BG,
plot_background=PAGE_BG,
foreground=INK,
foreground_strong=INK,
foreground_subtle=INK_MUTED,
colors=IMPRINT,
title_font_size=72,
label_font_size=48,
major_label_font_size=42,
legend_font_size=42,
value_font_size=36,
stroke_width=3,
)
# Plot
chart = pygal.Line(
width=4800,
height=2700,
title="line-basic · pygal · anyplot.ai",
x_title="Month",
y_title="Temperature (°C)",
style=custom_style,
show_dots=True,
dots_size=8,
stroke_style={"width": 5},
show_y_guides=True,
show_x_guides=False,
x_label_rotation=0,
legend_at_bottom=True,
truncate_legend=-1,
)
chart.x_labels = months
chart.add("Average Temperature", temperatures)
# Save
chart.render_to_png(f"plot-{THEME}.png")
with open(f"plot-{THEME}.html", "wb") as f:
f.write(chart.render())
Part of Basic Line Plot on anyplot.ai.