`ax.plot([0,1,2], [0,1,2], label="a_b_c"); ax.legend()` Expected output: `\addlegendentry{a\_b\_c}` Actual output: `\addlegendentry{a_b_c}` which will not compile in Latex.