element_51.figuresΒΆ

PNG files of a chart or a picture, for Save as PNG.

A chart is drawn by matplotlib on a white page, a picture is enlarged by a whole number with Pillow. Both come out at 300 dpi. matplotlib and numpy are loaded the first time a chart is drawn, so import element_51 stays quick.

Functions

chart_png(lines)

Draw lines as one chart and return it as a PNG file.

contrast_with_white(colour)

Find the WCAG contrast ratio of colour against white.

darken_to(colour[, ratio])

Darken colour, keeping its hue, until white shows it at ratio.

picture_png(image)

Enlarge image by a whole number to fill the page and return a PNG.

Classes

Line(*, name, values, colour, chosen)

One line of a chart.