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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| import plotly.graph_objects as go
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] x_rev = x[::-1]
y1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] y1_upper = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] y1_lower = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] y1_lower = y1_lower[::-1]
y2 = [5, 2.5, 5, 7.5, 5, 2.5, 7.5, 4.5, 5.5, 5] y2_upper = [5.5, 3, 5.5, 8, 6, 3, 8, 5, 6, 5.5] y2_lower = [4.5, 2, 4.4, 7, 4, 2, 7, 4, 5, 4.75] y2_lower = y2_lower[::-1]
y3 = [10, 8, 6, 4, 2, 0, 2, 4, 2, 0] y3_upper = [11, 9, 7, 5, 3, 1, 3, 5, 3, 1] y3_lower = [9, 7, 5, 3, 1, -.5, 1, 3, 1, -1] y3_lower = y3_lower[::-1]
fig = go.Figure()
fig.add_trace(go.Scatter( x=x + x_rev, y=y1_upper + y1_lower, fill='toself', fillcolor='rgba(0,100,80,0.2)', line_color='rgba(255,255,255,0)', showlegend=False, name='Fair', )) fig.add_trace(go.Scatter( x=x + x_rev, y=y2_upper + y2_lower, fill='toself', fillcolor='rgba(0,176,246,0.2)', line_color='rgba(255,255,255,0)', name='Premium', showlegend=False, )) fig.add_trace(go.Scatter( x=x + x_rev, y=y3_upper + y3_lower, fill='toself', fillcolor='rgba(231,107,243,0.2)', line_color='rgba(255,255,255,0)', showlegend=False, name='Ideal', )) fig.add_trace(go.Scatter( x=x, y=y1, line_color='rgb(0,100,80)', name='Fair', )) fig.add_trace(go.Scatter( x=x, y=y2, line_color='rgb(0,176,246)', name='Premium', )) fig.add_trace(go.Scatter( x=x, y=y3, line_color='rgb(231,107,243)', name='Ideal', ))
fig.update_traces(mode='lines') fig.show()
|