def template(temp, val):
    """
    Format a ufloat quantity for matplotlib plotting (e.g. nice +/- signs).
    """
    def format_ufloat(val):
#        return r'%0.1f$\pm$%0.1f' % (val.nominal_value, val.std_dev)
        return r'%0.1f+/-%0.1f' % (val.nominal_value, val.std_dev)
    if not isinstance(val, list):
        val = [val]
    val = [format_ufloat(item) for item in val]
    return temp.format(*val)