3

How can I change the font of matplotlib tick labels? I'd like to change it to Computer Modern 10 (called "cm" in matplotlib I believe), however, I don't want to render it in TeX. I've tried numerous ways of doing this, but none of them seem to work.

Axel Persinger
  • 331
  • 2
  • 14

1 Answers1

-3
func = lambda x, pos: "" if np.isclose(x,0) else x
plt.gca().xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(func))
plt.gca().yaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(func))

Works in my case!

Axel Persinger
  • 331
  • 2
  • 14