Matplotlib: How to format temperature in degrees Celsius (°C)

Based on our previous post on Matplotlib custom SI-prefix unit tick formatters, this is a simple snippet which you can use to format the Y axis of your matplotlib plots:

import matplotlib.ticker as mtick
from matplotlib import pyplot as plt

def format_celsius(value, pos=None):
    return f'{value:.1f} °C'