I am trying to plot some data using a custom font for the axis of my matplotlib plot. This font does not have unicodes. Thus the error I have is:
Font 'default' does not have a glyph for '-' [U+2212], substituting with a dummy symbol.
I set, as suggested in the official documentation, this:
matplotlib.rcParams['axes.unicode_minus'] = False
However, I still get the warning above.
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.font_manager
%matplotlib inline
# Font set
path = 'bahnschrift_reg.ttf'
prop = matplotlib.font_manager.FontProperties(fname=path)
mpl.rcParams['axes.unicode_minus'] = False
# Plot
f, ax = plt.subplots(1,1)
ax.set_xscale('symlog', linthresh=0.001)
ax.set_xlim(-0.0001, 100)
ax.set_ylim(0, 1.02)
# Set the font
for label in ax.get_xticklabels():
label.set_fontproperties(prop)
plt.show()
The font I am using is here. Could you help me, please?