MRule
MRule

Reputation: 620

Stop matplotlib from using the Arial font

I am using matplotlib on ubuntu 14.04

I am trying to control the fonts used for plotting in matplotlib. My understanding is that it is not possible to exactly control the font if you want to use LaTeX support. However, I would like to exclude Arial from the list of fonts matplotlib can use, as I find it hard to read.

Matplotlib on my other Ubuntu machine defaults to a cleaner sans-serif font ( not sure which, I think DejaVu? ) that I prefer. However, I am unable to convince matplotlib to behave similarly on this machine.

I'm about to achieve this by simply removing the Arial font from my system -- but surely there is a better way?

Upvotes: 0

Views: 827

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 881555

According to http://matplotlib.org/users/customizing.html , you should be able to customize what fonts can be chosen of, for a given family, by de-commenting and appropriately editing the line:

#font.sans-serif     : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif

in your matplotlibrc file. I have not verified that this works with LaTex mode, but according to the comments at that URL it should.

Upvotes: 2

Related Questions