How to Plot this Particular Plot for my project with Plotly in Python

Hi, Good Day, please I want to plot total expenditure for different department and data using the time series approach and am finding it difficult. I have made a sketch of the particular plot I want to do in my project. I am half done with the projects and I need lessons on how to plot this particular plot using Plotly in Python. I am plotting how much was spent in every year from 2016 to 2019 with legend showing the unique department and their expenditure through 2016 to 2019. Please if there is any available link kindly help me.

Thank you.

you did not share what you have tried so far.
there are likely many ways to accomplish that.

here is one way …

import numpy as np
import pandas as pd
from datetime import datetime
import as px

N = 100

x_date = pd.date_range(end =, periods = N).to_pydatetime().tolist()

y0 = np.random.randint(10000, 20000, N)
y1 = np.random.randint(20000, 30000, N)
y2 = np.random.randint(30000, 40000, N)
y3 = np.random.randint(40000, 50000, N)

data = {'date': x_date,
                'aapl': y0,
                'moto': y1,
                'radn': y2,
                'huwe': y3}
df = pd.DataFrame(data)

df_plot = pd.melt(df, id_vars=['date'], value_vars=['aapl', 'moto', 'radn', 'huwe'])

fig_expenses = (px.scatter(
    data_frame=df_plot, x='date', y='value',
    title='total expenses',
    hover_data=['date', 'variable'],