-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
52 lines (50 loc) · 1.84 KB
/
Copy pathplot.py
File metadata and controls
52 lines (50 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import plotly.graph_objs as go
import streamlit as st
def plot(forecasts, confidence_interval, periods):
'''
Функция строит график прогноза модели
'''
lower_ci = {"x": confidence_interval.index,
"y": confidence_interval['ДИ нижний'],
"line": {
"color": "#1EBC61",
"shape": "linear",
"width": 0.1
},
"mode": "lines",
"name": "Менее 95%",
"showlegend": False,
"type": "scatter",
"xaxis": "x",
"yaxis": "y"
}
upper_ci = {"x": confidence_interval.index,
"y": confidence_interval['ДИ верхний'],
"fill": "tonexty",
"line": {
"color": "#1EBC61",
"shape": "linear",
"width": 0.1
},
"mode": "lines",
"name": "Более 95%",
"type": "scatter",
"xaxis": "x",
"yaxis": "y"
}
forecasting = {'x': forecasts.index,
'y': forecasts.values,
"line": {
"color": "#005C01",
"shape": "linear",
"width": 3
},
"mode": "lines",
"name": "Прогноз",
"type": "scatter",
"xaxis": "x",
"yaxis": "y" }
plot_data = ([lower_ci, upper_ci, forecasting])
layout = go.Layout(title = 'Прогноз')
fig = go.Figure(data = plot_data, layout=layout)
st.plotly_chart(fig)