c00kiemonster
c00kiemonster

Reputation: 23361

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?

Upvotes: 5

Views: 3477

Answers (3)

nburrus
nburrus

Reputation: 154

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])

Upvotes: 1

Mark
Mark

Reputation: 108567

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

Upvotes: 0

Jouni K. Seppänen
Jouni K. Seppänen

Reputation: 44142

It seems this is not possible. Some classes such as Line2D have a "set_antialiased" method, but Text lacks this. I suggest you file a feature request on the Sourceforge tracker, and send an email to the matplotlib mailing list mentioning the request.

Upvotes: 1

Related Questions