1

I want to use the font Opensans in my plots, but I can't find a way to add the .ttf file to Bokeh/Python. I found a way to do it for matplotlib, is there a similar way in Bokeh 0.12.2? How to use a (random) *.otf or *.ttf font in matplotlib?

Thanks!

Gert

Community
  • 1
  • 1
GMath
  • 155
  • 1
  • 12

1 Answers1

0

Bokeh renders on HTML canvas, so you will have to follow the guidance in How can I use custom fonts in an HTML5 Canvas element? by putting the Bokeh plot in a custom template, then including CSS like:

@font-face { font-family: 'MyWebFont'; src: url('myfont.ttf') format('truetype'); }

to load the font and make it available. There are various ways to embed bokeh plots and documents into templates. Without knowing more, I can only point you at the docs:

https://docs.bokeh.org/en/latest/docs/user_guide/embed.html

bigreddot
  • 33,642
  • 5
  • 69
  • 122