Black Lives Matter. Please consider donating to Black Girls Code today.

Histogram with time slider

Hi,
I am trying to plot a histogram like the bottom pink one from the Plotly official examples, and add to it a time slider.

The code of the example histogram is:

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

import numpy as np
x0 = np.random.randn(500)
x1 = np.random.randn(500)+1

trace1 = go.Histogram(
x=x0,
histnorm=‘count’,
name=‘control’,
autobinx=False,
xbins=dict(
start=-3.5,
end=3.0,
size=0.5
),
marker=dict(
color=’#FFD7E9’,
),
opacity=0.75
)
trace2 = go.Histogram(
x=x1,
name=‘experimental’,
autobinx=False,
xbins=dict(
start=-2.0,
end=5,
size=0.5
),
marker=dict(
color=’#EB89B5
),
opacity=0.75
)
data = [trace1, trace2]

layout = go.Layout(
title=‘Sampled Results’,
xaxis=dict(
title=‘Value’
),
yaxis=dict(
title=‘Count’
),
bargap=0.2,
bargroupgap=0.1
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename=‘styled histogram’)

while the code of the example slider is:

data = [dict(
visible = False,
line=dict(color=‘f97e02’, width=6),
name = '𝜈 = '+str(step),
x = np.arange(0,10,0.01),
y = np.sin(step*np.arange(0,10,0.01))) for step in np.arange(0,5,0.1)]
data[10][‘visible’] = True

steps = []
for i in range(len(data)):
step = dict(
method = ‘restyle’,
args = [‘visible’, [False] * len(data)],
)
step[‘args’][1][i] = True # Toggle i’th trace to "visible"
steps.append(step)

sliders = [dict(
active = 10,
currentvalue = {“prefix”: "Frequency: "},
pad = {“t”: 50},
steps = steps
)]

layout = dict(sliders=sliders)

fig = dict(data=data, layout=layout)

plotly.offline.plot(fig, filename=‘Sine Wave Slider’)

How would a combination of both work? What I would like to have is a histogram just like above (with my own data), and add to it a time slider so that I can view the histogram over different days. I would be very thankful for any help or suggestions!