afcharts-py cookbook

Python charts in the Analysis Function style

Welcome

afcharts logo

The afcharts python package helps make accessible Matplotlib and Plotly charts that meet Government Analysis Function best practice.

This cookbook includes a Getting Started guide and example code for various chart types in Matplotlib and Plotly.

Visit the GitHub repository to submit a question or suggestion via the Discussion or Issues pages.

Tip

Looking for the afcharts R package? Check out afcharts

Package features

  • Automatic chart formatting with pre-built style sheets for Matplotlib and Plotly. These set a variety of chart properties to meet the Analysis Function accessibility guidance for charts, such as fonts, axes and grid lines.
  • Chart colours from the Analysis Function accessible colour palettes for data visualisation. These palettes were designed with experts to maximise clarity and accessibility.
  • Example code for common chart types such as line charts, bar charts, scatterplots and small multiples. Re-use these code snippets for your own charts to save time and repeat best practices.

Accessibility note: Alternative text for all example charts can be found in the body text directly beneath each example.