I'm trying to get the italics font to match the font used for the rest of the axes labels but its not working as expected.
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.family'] = 'Garuda'
#solution is to change mathtext italics as suggested below
plt.rcParams['mathtext.it']= 'Garuda:italic'
plt.rcParams['mathtext.cal']= 'Garuda:italic'
plt.rcParams['mathtext.default'] = 'regular'
plt.rcParams["mathtext.fontset"] = 'custom'
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_title('Plot $\it{ugly}$ $\it{italics}$', fontsize=14)
ax.text(-0.1, -0.5, 'nice italic font', style='italic', fontsize=14)
ax.set_xlabel('Nice$_2$ font', fontsize=14)
ax.set_ylabel('$Nice^+$ font', fontsize=14)
ax.tick_params(labelsize=12)
plt.show()
As it can be seen in the figure, the title has a mix between regular and italic fonts. How can I mix both types of font?