0

How to use a (random) *.otf or *.ttf font in matplotlib?

The above answer provides a nice way of using a custom font for your whole matplotlib install (globally). But I would like matplotlib to globally use a custom font that I don't have installed on my system, and hence don't have a valid font-family "name" to use in my .matplotlibrc file.

I also cannot install any fonts on this machine as I do not have root access and the linux machine I am on is remote (part of lab wide linux distro, debian wheezy) so trying things like this http://tsengf.blogspot.com/2012/03/install-new-fonts-in-linux-without-root.html to install a font without root privilege is not working for me.

Thanks!

Community
  • 1
  • 1
SullX
  • 214
  • 4
  • 17
  • I don't see why the server being remote should matter for the non-root font installations. – tacaswell Nov 22 '13 at 23:03
  • And I don't understand why the question you link to doesn't work. What happens if you just make a `fm.FontProperties` object pointing to where ever the font is in your home directory? – tacaswell Nov 22 '13 at 23:06
  • Re: your first comment: Installing a font on a non root computer can usually be done using the blogspot link above. However, because I am remote the linux function xset (used to specify a font directory), looks for fonts through Xming (which is the xserver I am running). I therefore haven't been able to figure out how to complete that tutorial for the remote system. – SullX Nov 27 '13 at 15:11
  • Re: your second comment: Making a fm.FontProperties object that points to the font, as in the stackoverflow link I noted above will only set the font for matplotlib objects I tell to use that object. Meaning I have to tell each object (axis labels, plot key, plot title, etc) separately to use the font object I created, rather than setting it 'globaly', like you can with a font that is installed on your system. Does that make sense? – SullX Nov 27 '13 at 15:14

0 Answers0