I am using Plotly for Python to generate some stacked bar charts. Since I have 17 objects which are getting stacked, the colour of the bars has started repeating as seen in the image below.
Can someone tell me how to get unique colours for each stack?
Please find my code to generate the bar chart below:
import plotly
plotly.tools.set_credentials_file(username='xxxxxxxx',
api_key='********')
dd = []
import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np
for k,v in new_dict.items():
trace = go.Bar(x = x['unique_days'],
y = v,
name = k,
text=v,
textposition = 'auto',
)
dd.append(trace)
layout= go.Layout(
title= 'Daily Cumulative Spend per campaign',
hovermode= 'closest',
autosize= True,
width =5000,
barmode='stack',
xaxis= dict(
title= 'Date',
zeroline= False,
gridwidth= 0,
showticklabels=True,
tickangle=-45,
nticks = 60,
ticklen = 5
),
yaxis=dict(
title= 'Cumulative Spend($)',
ticklen= 5,
gridwidth= 2,
),
showlegend= True
)
fig = dict(data=dd, layout = layout)
py.iplot(fig)