ALT text generated for two charts includes (at left): A radial line plot titled ’avg. Monthly hours of sunshine in seattle’. The x-axis ranges from jan to dec using a datetime scale and the y-axis ranges from 0 to 312 using a linear scale. Avg. Hours of sunshine is plotted in orange. Avg. Hours of sunshine has a minimum value of y=52 at x=dec, a maximum value of y=312 at x=july, and an average of y=180.2. (at right) A 7x6 heatmap titled ’number of points from combined gaussians’. The x-axis ranges from -8 to 6, the y-axis ranges from -4 to 8, and number of gaussian points is plotted on the z-axis from 0 to 61, all using linear scales. The data has a minimum value of z=0 at (-8, -4), a maximum value of z=61 at (0, -4), and an average of z=14.19.

MatPlotAlt

MatplotAlt is an open-source Python package for easily adding alternative text to matplotlib figures. MatplotAlt equips Jupyter notebook authors to automatically generate and surface chart descriptions with a single line of code or command, and supports a range of options that allow users to customize the generation and display of captions based on their preferences and accessibility needs. MatplotALT on a11yhood.org.

Our evaluation indicates that MatplotAlt’s heuristic and LLM-based methods to generate alt text can create accurate long-form descriptions of both simple univariate and complex Matplotlib figures. We find that state-of-the-art LLMs still struggle with factual errors when describing charts, and improve the accuracy of our descriptions by prompting GPT4-turbo with heuristic-based alt text or data tables parsed from the Matplotlib figure.

Here is some example ALT text generated for the pie chart shown below. A variety of examples can be found in the MatPlotAlt documentation.

A pie chart titled ’percentage of annual sunshine’. There are 12 slices: jan (3.19%), feb (4.993%), mar (8.229%), apr (9.57%), may (11.7%), june (12.39%), july (14.42%), aug (12.99%), sep (10.22%), oct (6.565%), nov (3.329%), and dec (2.404%). The data has a standard deviation of x=4.006, an average of x=8.333, a maximum value of x=14.42, and a minimum value of x=2.404. The data strictly increase up to their max at x=14.42, then strictly decrease.

A pie chart titled ’percentage of annual sunshine’. There are 12 slices: jan (3.19%), feb (4.993%), mar (8.229%), apr (9.57%), may (11.7%), june (12.39%), july (14.42%), aug (12.99%), sep (10.22%), oct (6.565%), nov (3.329%), and dec (2.404%). The data has a standard deviation of x=4.006, an average of x=8.333, a maximum value of x=14.42, and a minimum value of x=2.404. The data strictly increase up to their max at x=14.42, then strictly decrease.

Kai Nylund, Jennifer Mankoff, Venkatesh Potluri: MatplotAlt: A Python Library for Adding Alt Text to Matplotlib Figures in Computational Notebooks. Comput. Graph. Forum 44(3) (2025)

Leave a Reply

Your email address will not be published. Required fields are marked *