Define global config values for plotly's Figure show method

Viewed 206

A plotly Figure has show() method which accepts a config argument, as per documentation

import plotly.graph_objects as go

fig = go.Figure()

config = dict({'scrollZoom': True})

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config=config)

This can be quite tedious, as I have to catch the Figure and show it with the show method instead of normal usage.

Instead of just doing

px.line(df)

Now I have to

fig = px.line(df)
fig.show(config=config)

In all charts. Is there a way through the Plotly library to define the config values globally, so that I can call px.line without setting the config per Figure instance, and I dont have to create a custom wrapper?

0 Answers
Related