✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Font styling in Python using custom font

Hello everyone,

I am trying to edit the font title of my graph in Plotly. I’ve read this article on how to change the title font: https://plot.ly/python/font/ but I can’t manage to make it work with the font I want (Franklin Gothic) which is installed on my computer. I don’t have any error but my title is written with the default font.

Is there a way to find all the available fonts in Plotly? And is it possible to add new custom fonts?

I am working with plotly 3.3.0 on jupyter notebook.

Thanks for your help!

1 Like

Hi @julied20, The font you set in your code is displayed only if it’s installed on your computer.

I ran this code:

import plotly.graph_objs as go

data = [
        x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
        y=[0, 1, 2, 3, 4, 5, 6, 7, 8]
layout = go.Layout(width=500, height=300,
    title='Franklin Gothic Font',
    font=dict(family="Franklin Gothic", size=18)
fig = go.FigureWidget(data=data, layout=layout)

and here is the plot:

It seems to be Franklin Gothic. Hence it is installed on my system.

I’m encountering the same problem. I have the custom font I want installed on my server on EC2, but figures fail to render the custom font.

The custom font renders correctly on my local machine but not on the server. Is there a way to check what fonts are available to plotly? And where it tried to load them from?