Hipparkhos
Hipparkhos

Reputation: 85

How to make my matplotlib rc module preferable parameters as defaults to all my python files?

I have the following code at my python scripts

from matplotlib import rc

rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)

params = {'text.usetex': True,
      'axes.labelsize': 18}`

I want to have those preference as defaults when I start a python console instead of copy paste all the time.

Do you know if this is possible?

Cheers!

Upvotes: 1

Views: 158

Answers (2)

unutbu
unutbu

Reputation: 879341

Customize your matplotlibrc file by adding or uncommenting:

font.family         : sans-serif
font.sans-serif     : Helvetica
text.usetex         : True
axes.labelsize      : 18

See ThePredator's answer to find out where your matplotlibrc file is located.

Upvotes: 3

Srivatsan
Srivatsan

Reputation: 9363

You can see the webpage for more details

Use mpl.matplotlib_fname() to get your rc file path, and modify it according to your manual settings.

In [1]: import matplotlib as mpl 

In [2]: mpl.matplotlib_fname()
Out[2]: '/etc/matplotlibrc'

In my case the file exists at /etc/matplotlibrc

Upvotes: 1

Related Questions