Matplotlib tricks

Two little things I need now and then and am tired of looking up. To change the default font to one which supports Greek characters:

from matplotlib import rcParams
rcParams['font.sans-serif'] = 'DejaVu Sans'

To scale the xticklabels:

ax.set_xticklabels([ int(np.round(i)) for i in ax.get_xticks()*10**6 ])

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.