def millions(x, pos=0):
    """Expects value and tick position
     returns string formatted for thousands and millions
     """
    #length of float value within thousands boundry
    if len(str(x)) <=8 :
        return '%1.1fK' % (x*1e-3)
    #length of float value within millions boundry
    return '%1.1fM' % (x*1e-6)