I followed this answer to Sans-serif math with latex in matplotlib to get my matplotlib to use Computer Modern Sans. That works splendidly, except I can't get upright mu's to work. There's a ton of questions that go into that, but somehow I can't make it consistent with the above code.
What I'm using now is
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
plt.rcParams['text.latex.preamble'] = [r'\usepackage[cm]{sfmath}']
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = 'cm'
But when I try to do something like
plt.figure()
plt.text(0,0.5,r'$50 \mathrm{\mu m}$', size=16, c='k')
I just end up with a slanted mu. If instead I use \textmu, the character completely disappears and I get 50 m.
I tried doing something like this and then using \micro, but it just results in errors saying that that's an unknown symbol. Even though my MikTeX tells me siunitx is installed.
I'm sure this is just a silly mistake on my end, and I apologise if that is the case, but for the past 4 hours I have not been able to make any progress so I figured I would ask here.