I'm plotting some text in a figure with ax.text()
method, of matplotlib. Nevertheless, if the string var
contains underscores, this are understood as subindixes.
Is this a bug to report? Or am I doing something wrong. I have already tried with '\033[3m' characters, but no italic letter show up. Since not all the text goes in italic, I cannot change rc.Params.
Any aid is appreciated.
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
var = 'Hello_12'
text = f"Dataset: ${var}$"
ax.text(0.5,0.5, text)