I would like to use the Computer Modern (cm) font in Paraview for Latex math rendering, but this solution, i.e. editing the matplotlibrc file, does not work for me.
Troubleshooting:
- edit
C:\Users\user\.matplotlib\matplotlibrcandC:\Program Files\ParaView 5.13.1\bin\Lib\site-packages\matplotlib\mpl-data\matplotlibrc - add
mathtext.fontset: cmandmathtext.rm: serif(the rest remains unchanged) - in Paraview, add Programmable Source and run
import matplotlib as mpl
print(mpl.get_configdir())
print(mpl.rcParams["mathtext.fontset"])
print(mpl.rcParamsOrig["mathtext.fontset"])
print(mpl.rcParams["mathtext.rm"])
- this confirms the changes and prints
C:\Users\user\.matplotlib,cm,cm,serif - add Text Source with
$\mathrm{Text}$ $\phi$, which produces the following output

- for reference, this is expected

- re-running the Programmable Source now outputs
C:\Users\user\.matplotlib,dejavusans,cm,serif
This suggests to me, that Paraview sets the mathtext font to Dejavu Sans somewhere during the text rendering process.
I’m on Windows 11 with Paraview 5.13.1