# Plotting seasonal data – python

I work with a lot of timeseries data and would love a way to simply plot it seasonally;

For example;

```            A  B  C  D  E  F  G H I
01/01/2008  4  4  43 4  3 4  3  4 3
02/01/2008  43 3  4  3  34  3  4  3
03/01/2008 11 2  3 4  3  4  3 44 3
.
.
.
07/08/2021 43 3  4  3  34  3  4  3
08/09/2021 43 3  4  3  34  3  4  3

```

Is there an efficient or python-y way to plot this so that it would resemble a seasonality chart but on daily granularity?

Something that may resemble the below? Ideally this may also create a dataframe with yearly columns of data with the index being dd/mm date format to also use.

Any help much appreciated!

• simple in plotly
• have simulated your data with random data
• key step is an x-axis that is constant across the years for seasonality. Have used dates in 2021 using day of year to generate a date in 2021. Second step is setting date format as year is irrelevant
• clearly no seasonality in my data as it is random…
```import numpy as np
import pandas as pd
import plotly.express as px

n = 365 * 14
df = pd.DataFrame(
index=pd.date_range("1-jan-2008", periods=n),
data={c: np.random.randint(1, 45, n) for c in list("ABCDEFGHI")},
)

fig = px.line(
df.assign(
year=df.index.year,
doy=pd.to_datetime(df.index.day_of_year.values + (2021 * 1000), format="%Y%j"),
value=df.mean(axis=1),
),
x="doy",
y="value",
color="year",
template="plotly_dark"
)

# just for demo purposes, make some traces invisible
for t in fig.data:
if int(t["name"])<2016: t["visible"]="legendonly"

fig.update_layout(xaxis={"tickformat":"%d-%b"})

``` 