How to create an area plot in plotly python

Can somebody tell me how can we create area charts with smooth lines (I am sorry I dont know what these are called) like this:
image

He @ghulam_shabbir_khan welcome to the forums.

This should get you started:

I think you can use line_shape = 'spline' to make it look smoother. Something as below:

import pandas as pd
import plotly.express as px

df = px.data.stocks()
df = df.drop('AMZN', axis = 1)
colors = px.colors.qualitative.T10

fig = px.area(df, 
                 x = 'date',
                 y = [c for c in df.columns if c != 'date'],
                 template = 'plotly_dark',
                 color_discrete_sequence = colors,
                 title = 'Stocks', line_shape='spline'
             )
fig.show()

2 Likes

Thank you @hoatran and @AIMPED for your answers. I have tried your suggestions and have achieved the desired functionality.

1 Like