Fix warning about missing font when "cm" is not installed on the system

Use "cm" as preferred serif font, but keep the default serif fonts afterwards in the priority list.
This commit is contained in:
Lucas Verney 2016-03-31 15:02:06 +02:00
parent 3d1eeda8aa
commit 3ae9b66f30

View File

@ -3,6 +3,8 @@ Functions to set custom :mod:`matplotlib` parameters.
""" """
import shutil import shutil
import matplotlib as mpl
import numpy as np import numpy as np
@ -26,7 +28,7 @@ def custom_rc(rc=None):
# Use LaTeX default font family # Use LaTeX default font family
# See https://stackoverflow.com/questions/17958485/matplotlib-not-using-latex-font-while-text-usetex-true # See https://stackoverflow.com/questions/17958485/matplotlib-not-using-latex-font-while-text-usetex-true
custom_rc_["font.family"] = "serif" custom_rc_["font.family"] = "serif"
custom_rc_["font.serif"] = "cm" custom_rc_["font.serif"] = ["cm"] + mpl.rcParams["font.serif"]
# Scale everything # Scale everything
custom_rc_.update(_rc_scaling()) custom_rc_.update(_rc_scaling())
# Set axes style # Set axes style