Black Lives Matter. Please consider donating to Black Girls Code today.

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: 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!

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.