Trực quan hóa dữ liệu giúp hiểu nhanh mà không cần tính toán phức tạp.
Pygal: package Python mã nguồn mở tạo biểu đồ tương tác, SVG co giãn, nhúng web/dự án.
Pygal hỗ trợ: bar chart, histogram, line plot, funnel...
Funnel chart trực quan hóa sự giảm/giảm dần qua các giai đoạn. Dùng cho sales, stock data...
Cài đặt: pip install Pygal
Ví dụ
import pygal
from pygal.style import Style
custom_style = Style(colors=('#E80080', '#404040', '#9BC850', '#E81190'))
funnel_chart = pygal.Funnel(height=400, width=300, style=custom_style)
funnel_chart.title = "Funnel plot"
funnel_chart.add("label 1", [0.4])
funnel_chart.add("label 2", [1.2])
funnel_chart.add("label 3", [1.5])
funnel_chart.add("label 3", [1.8])
funnel_chart.render_in_browser()
Đầu ra

Giải thích
- Import pygal và Style.
- Tạo
pygal.Funnelvới height, width, style. - Đặt title, thêm dữ liệu từng nhãn.
render_in_browser()hiển thị funnel chart trên trình duyệt.