0

I am trying to change the font family and style of x- and y-ticks of a plot. Here is what I do:

import matplotlib.pyplot as plt
from matplotlib import rc
font = {'family' : 'sans-serif',
    'weight' : 'bold',
    'size'   : 10}

rc('font', **font)
rc('text', usetex=True)

data = range(100)

fig, ax = plt.subplots(1, 1)
ax.scatter(data, data)
plt.show()

The only parameter from 'font' that has an influence on ticks is 'size'. Why do 'weight' and 'family' not have an influence on the ticks?

gimba
  • 491
  • 1
  • 8
  • 26
  • 1
    Because the ticks are rendered in math mode. Maybe [this](https://stackoverflow.com/questions/51405646/matplotlib-ticks-sans-serif-for-all-plots/51409039#51409039) helps. – ImportanceOfBeingErnest Feb 13 '19 at 19:06
  • @ImportanceOfBeingErnest: Your linked answer `ax.xaxis.get_major_formatter()._usetex = False` actually solved one problem of mine for my publication figures. Upvoted. Thanks a lot! – Sheldore Feb 13 '19 at 20:54

0 Answers0