Skip to content

Instantly share code, notes, and snippets.

@kurasaiteja
Created July 28, 2020 12:58
Show Gist options
  • Select an option

  • Save kurasaiteja/887ab9be4f86b7624568064e6a52f4aa to your computer and use it in GitHub Desktop.

Select an option

Save kurasaiteja/887ab9be4f86b7624568064e6a52f4aa to your computer and use it in GitHub Desktop.
fig = go.Figure()
fig.add_trace(go.Scatter(
x=[lockdown1,lockdown2,lockdown3,lockdown4,unlock1,unlock2],
y=[39,39,39,39,39,39],
text=["Lockdown 1","Lockdown 2","Lockdown 3", "Lockdown 4", "Unlock 1", "Unlock 2"],
mode="text",
))
l = df_india_Telangana.columns
colors = ['rgba(152, 0, 0, .8)','green','red','orange','MediumPurple','DarkBlue']
for i in range(len(l)):
fig.add_trace(go.Scatter(x=df_india_Telangana.index, y=df_india_Telangana[l[i]],
mode='lines+markers',
name=l[i],
marker_color=colors[i]))
fig.update_layout(xaxis=dict(range=[mindate,maxdate]))
fig.update_layout(
title= "Mobility Trends in Telangana",
width=1400,
height=600,
shapes=[
dict(
type="line",
x0=mindate,
y0=0,
x1=maxdate,
y1=0,
line_width=2,
line = dict(
dash = "dot"
)
),
dict(
type="line",
y0=-100,
x0= lockdown1,
y1=37,
x1=lockdown1,
line_width=2,
line = dict(
dash = "dot"
)
),
dict(
type="line",
y0=-100,
x0= lockdown2,
y1=37,
x1=lockdown2,
line_width=2,
line = dict(
dash = "dot"
)
),
dict(
type="line",
y0=-100,
x0= lockdown3,
y1=37,
x1=lockdown3,
line_width=2,
line = dict(
dash = "dot"
)
),
dict(
type="line",
y0=-100,
x0= lockdown4,
y1=37,
x1=lockdown4,
line_width=2,
line = dict(
dash = "dot"
)
),
dict(
type="line",
y0=-100,
x0= unlock1,
y1=37,
x1=unlock1,
line_width=2,
line = dict(
dash = "dot"
)
),
dict(
type="line",
y0=-100,
x0= unlock2,
y1=37,
x1=unlock2,
line_width=2,
line = dict(
dash = "dot"
)
)
]
)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment