Modify colour of titles in plotly graphical objects

246 Views Asked by At

How can I change the colours of xaxis and yaxis title's from plotly.graph_objs?

The documentation is a little bit confusing.

dcc.Graph(
    id='old_faithful',
    figure={
        'data': [
            go.Ohlc(
                x = df['timestamp'],
                open=df['open'],
                high=df['high'],
                low=df['low'],
                close=df['close'],
                
            )
        ],
        'layout': go.Layout(
            title = 'OHLC Chart IBM Share',
            xaxis_title =  'Zeitpunkt',
            yaxis_title =  'Shareprice',
            hovermode='closest', 
            paper_bgcolor = colors['background'],
            plot_bgcolor = colors['background']
            )
        }
    )
1

There are 1 best solutions below

1
On

Create your figure, for example:

figure = go.FigureWidget()

Then set the colors of the axis with the following:

figure.layout.xaxis.color = "choose a colour"
figure.layout.yaxis.color = "choose a colour"