David Hancock
David Hancock

Reputation: 473

Colors won't change on the multiple axis plotly example

I've tried changing the color on the code given in the 'Multiple Axes in Python' example, but the colors don't change. https://plot.ly/python/multiple-axes/

ie no matter what you change:

titlefont=dict(
    color='rgb(148, 103, 189)'
),
tickfont=dict(
    color='rgb(148, 103, 189)'

to, the colors stay the same on the chart

Any ideas?

Upvotes: 0

Views: 527

Answers (1)

Maximilian Peters
Maximilian Peters

Reputation: 31669

The colors should change without any problems, see the sample below (also works for RGB colors).

Are you sure that the attributes were put in legend (and in yaxis/2) and not in data?

enter image description here

import plotly.plotly as py
import plotly.graph_objs as go

trace1 = go.Scatter(
    x=[1, 2, 3],
    y=[40, 50, 60],
    name='yaxis data',
    marker={'color': 'red'}
)
trace2 = go.Scatter(
    x=[2, 3, 4],
    y=[4, 5, 6],
    name='yaxis2 data',
    yaxis='y2',
    marker={'color': 'blue'}
)
data = [trace1, trace2]
layout = go.Layout(
    title='Double Y Axis Example',
    yaxis=dict(
        title='yaxis title'
    ),
    yaxis2=dict(
        title='yaxis2 title',
        titlefont=dict(
            color='green'
        ),
        tickfont=dict(
            color='pink'
        ),
        overlaying='y',
        side='right'
    )
)
fig = go.Figure(data=data, layout=layout)
plot_url = py.plot(fig, filename='multiple-axes-double')

Upvotes: 1

Related Questions