How to plot two graph using plottly using same function in django

I am trying to plot two graphs on my Django index page. If I call two different functions, then I function is working, but another one is not when I try using the same function, then I do not understand how to give context and call this function here. I am sharing my code sample. Maybe anyone can explain me.

data_plots = go.Scatter(x=df2['MeterReading_DateTime'],y= df2['ACT_IMP_TOT'],marker = {'color' : '#335253'})
data_plots1 = go.Scatter(x=df3['MeterReading_DateTime'],y= df3['ACT_IMP_TOT'],marker = {'color' : '#335253'})
#data_plots = px.pie(values=random_x, names=names) 
layout = {'title': '','xaxis': {'title': 'Date and time'},'yaxis': {'title': 'Total Import(KWH)'},'plot_bgcolor':'#E8E8E8'}
fig = {'data': data_plots, 'layout': layout}
fig1 = {'data1': data_plots1, 'layout': layout}
plot_div = offline.plot(fig, output_type='div')
plot_div1 = offline.plot(fig1, output_type='div')
return plot_div,plot_div1

def home(request):
my_graph = homee(request)
context={'graph1':my_graph,'plot_div1':my_graph}
return render(request, "index.html", context)
Back to Top