How to set general font for graph with Plotly?

Viewed 3985

When plotting a graph with Plotly, is there a way to set a font for the whole figure at once (so that you don't have to set it individually for each element in your graph)?

For MatPlotLib this is done with:

matplotlib.pyplot.rcparams["font.family"] = "Calibri"

For Plotly this is done with:

?????
2 Answers

If you have a font (or any style really) that you want to apply to many figures

import plotly.figure_factory as ff

class Plot():
    def __init__(self):
        self.my_template = dict(
            layout=go.Layout(
                font=dict(family='Arial')
            )
        )


    def some_plot(self):
        #fig = ...
        fig.update_layout(template=self.my_template)
        return fig
Related