Text, title and legend format

Hello everyone, my query is the following:

I want to add formatting to certain words within a text title, such as color, bold, italic.
Also line breaks in some cases.

I leave an example used in another library where they format certain text:

plt.text(-0.52, 36,
         '$\\bf{BEFORE}$ program, the\n' 
         'majority of children felt\n'
         'just $\\mathit{OK}$ about science.', 

I find it impossible to do this in bokeh, and the solutions I found make the code ugly.

Does anyone have a more practical solution?

It’s not clear: are you trying to style the text for a plot title (which is always “outside” the central plot frame) or for some kind of label or text glyph (which is always “inside” the central plot frame)?


  • multi-line titles are not currently supported (but you can add multiple Title annotations that stack)
  • No “markup” is supported for styling in either case. For text or Label (or LabelSet) you could style individual words separately.