line plotly with shaded area 1

line plotly with shaded area

import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(go.Scatter(x=[1, 2, 3, 4],
                         y=[0, 2, 3, 5],
                         fill='tozeroy')
             ) # fill down to xaxis
fig.update_layout(title='Title',
                  xaxis_title='x',
                  yaxis_title='y')
fig.show()

Here is what the above code is Doing:
1. Create a figure object
2. Add a trace to the figure object
3. Update the layout of the figure object
4. Show the figure object

Similar Posts