Easier way to print in bold a string variable in matplotlib
问题 Today I'm having a very specific issue: I want to print a string variable inside a function using plt.text() in bold. I feel I'm pushing Python's graphing capabilities to the limit when mixing mathtext with the usual syntax. So, the important part of the function looks like this: def graph_text(var): string0=f'String is:'+r"$\bf{"+var+"}$" plt.text(string0) The thing is var are some strings that can have between one and three words. By default in mathtext strings are concatenated, so, for var