'Matplotlib turn off antialias for text in plot?

Is there any way to turn off antialias for all text in a plot, especially the ticklabels?



Solution 1:[1]

Did you try playing with the font/text properties of matplotlibrc ? That would be the first thing to try, I think (see here for examples: http://matplotlib.sourceforge.net/users/customizing.html)

Solution 2:[2]

I believe the anti-aliasing of Text objects is up to the font engine being used. It seems the freetype2 fonts support this.

Solution 3:[3]

Not sure if it already existed back in 2010, but I had the same issue and found that matplotlib has a text.antialiased parameter that applies to the tick labels too. Tested with the agg and cairo backends:

import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['text.antialiased'] = False
plt.plot([0,1,2], [3,4,5])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Cournapeau
Solution 2 Mark
Solution 3 nburrus