I want to write some text on a matplotlib axis. This text contains a linebreak and should be accessible to LaTex text-rendering.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as mpl
mpl.rc('font', family='sans-serif')
mpl.rc('text', usetex=True)
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
text = (r"This is the first line"
"\n"
r"And here comes the second one")
ax.text(0.2,0.5,text)
produces the following output:
Now I want to plug the two sentences together such that I am flexible regarding the different inputs of the complete text. I was thinking about somethin like
text_1 = "This is the first line"
text_2 = "And here comes the second one"
completeText = [text_1, text_2]
textIn = '⧹n'.join(map(str, completeText))
ax.text(0.2,0.5,textIn)
However, this produces the error
UnicodeEncodeError: 'ascii' codec can't encode character '\u29f9' in position 300: ordinal not in range(128)
Additionally, is it possible to put a bullet point like in LaTex itemize in front of every new line?
