matplotlib scratches

A collection of various lines of matplotlib which were useful at one time or another.

lossless webp

Matplotlib 3.6.0 added webp support!

Changing the plt.savefig() extension is adequate for getting this to work but will default to lossy compression. In order to match the bright coloring of lines in my previous PNG graphs, PIL needs to know to use the lossless method via pil_kwargs={'lossless':True}.

The composite image has the compressed section in the middle which washes out the colors.

lossless, compressed, and png composite image

plt.savefig(buf,format='webp',pil_kwargs={'lossless':True})