I have the following dataframe and plot below - and I want to add data points for each box plot in the factorplot but I am having trouble combining box and strip plots in to the same graph (i.e. they dont overlay, they appear below each other). Is there a solution for this?
import pandas as pd
import datetime
idx = pd.date_range('01-01-2020', '01-25-2020')
d = pd.Series({'01-01-2020': 1,
'01-25-2020': 1})
d.index = pd.DatetimeIndex(d.index)
d = d.reindex(idx, fill_value=0)
df = pd.DataFrame(d).rename_axis("dt").reset_index()
df.drop(columns=df.columns[1], inplace=True)
# calculate week number
df["week"] = df["dt"].dt.week
# create column counts for 'nhsbt centres'
df["A"] = np.random.randint(0, 50, df.shape[0])
df["B"] = np.random.randint(0, 30, df.shape[0])
df["C"] = np.random.randint(0, 20, df.shape[0])
# melt dataframe
df1 = df[["A", "B", "C", "week"]]
df1 = df1.set_index("week")
df1 = df1.melt(ignore_index=False)
df1["week"] = df1.index
# make boxplot
sns.factorplot("week", "value", col="variable", data=df1, kind="box")


seaborn.catplot, is to use.map, as shown in seaborn: Building structured multi-plot gridsseaborn.stripplotcan be used in place ofseaborn.swarmplotseaborn.factorplotwas renamed to.catplot, however, if you're using an older version ofseaborn,.mapshould still work..dt.weekis deprecated and should be replaced with.dt.isocalendar().weekpandas 1.3.2,seaborn 0.11.2andmatplotlib 3.4.3