The following code
using PyPlot, LaTeXStrings, PyCall
PyPlot.rc("font", family="serif", size=14)
fig = plot(rand(10))
xlabel(L"latex: $r [ \AA ]$")
produces a plot where all fonts are serif except the Latex text remains sans-serif.
This fixes it somewhat
using PyPlot, LaTeXStrings, PyCall
PyPlot.rc("font", family="serif", size=14)
rcParams = PyDict(PyPlot.matplotlib["rcParams"])
rcParams["text.usetex"] = true
fig = plot(rand(10))
xlabel(L"latex: $r [ \AA ]$")
but I think the font is still not consistent (though maybe one needs to fix the "serif" choice?)
Either way, this seems to be an issue since matplotlib 2.0; probably these issues are related:
I am not entirely sure what the default behaviour ought to be but the current behaviour certainly seems wrong. Maybe this will be fixed in a matplotlib update, so creating a work-around now might not be worthwhile, but I couldn't tell from those issues whether this was actually the case.
The following code
produces a plot where all fonts are serif except the Latex text remains sans-serif.
This fixes it somewhat
but I think the font is still not consistent (though maybe one needs to fix the "serif" choice?)
Either way, this seems to be an issue since matplotlib 2.0; probably these issues are related:
I am not entirely sure what the default behaviour ought to be but the current behaviour certainly seems wrong. Maybe this will be fixed in a matplotlib update, so creating a work-around now might not be worthwhile, but I couldn't tell from those issues whether this was actually the case.