I have a list of chars that I plot as title with its corresponding x coordinates using matplotlib's text. I have a string that will exist as a pattern within the plotted text. How do I bolden and underline the string once found in the title. Here is what I have so far.
import matplotlib.pyplot as plt
st = ['D', 'K', 'J', 'K', 'D', 'J', 'K', 'D', 'K', 'D', 'D', 'T', 'T', 'D']
word = 'KDDT'
fig, ax = plt.subplots()
st1 = [x for x, y in enumerate(st)]
ax.set_xticks(st1)
loc = 1.2
arg = dict(fontsize=10, va='top')
for x, y in enumerate(st):
ax.text(x, loc, y, **arg )
plt.plot(range(14), range(14))
plt.show
I get the title on top but I am not sure how to proceed with the bold and underline of the word KDDT within the title on the plot. The word can occur anywhere within the st list.