I am trying to create a scatter graph with three traces as well as axes for each scatter graph. Here is my code. My data is located in a pandas table. For some reason, only the third trace is showing up in the main graph, but all three lines are showing up in the dragging application created at the bottom.
trace1 = go.Scatter(
x = all_data['Date'],
y = all_data['Revenue'],
name = "Revenues",
line = {'color': "#008000"},
mode = 'lines')
trace2 = go.Scatter(
x = all_data['Date'],
y = all_data['total'],
name = "Cost",
line = {'color': "#ff0000"},
mode = 'lines',
yaxis='y2')
trace3 = go.Scatter(
x=all_data['Date'],
y=all_data['Visits'],
name = "Visits",
line = {'color': "#0000ff"},
mode = 'lines',
yaxis='y3')
day_data = [trace1, trace2, trace3]
layout = go.Layout(
title='Revenue, Cost and Website Visits (Daily)',
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label='1m',
step='month',
stepmode='backward'),
dict(count=6,
label='6m',
step='month',
stepmode='backward'),
dict(step='all')
])
),
domain=[0.25, 0.75],
rangeslider=dict(
visible = True
),
type='date'
),
yaxis = dict(
title='Revenue',
titlefont=dict(
color='#008000'
),
tickfont=dict(
color='#008000'
),
anchor='x',
overlaying='y',
side='left',
position=0
),
yaxis2 = dict(
title='Cost',
titlefont=dict(
color='#ff0000'
),
tickfont=dict(
color='#ff0000'
),
anchor='x',
overlaying='y',
side='right',
),
yaxis3=dict(
title='Visits',
titlefont=dict(
color='#0000ff'
),
tickfont=dict(
color='#0000ff'
),
anchor='free',
overlaying='y',
side='right',
position=.95
)
)
fig1 = go.Figure(data=day_data, layout=layout)
py.iplot(fig1)
csv: https://github.com/mcyee90/MedMen/blob/master/all_data.csv