I've some datasetfor which I'm using seaborn catplot of kind=box.
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
vertdf_dir = pd.read_csv(folder + "/" + filename)
meandf_dir = pd.DataFrame(columns=["NumFlights", "fix", "delay"])
k = 0
for i in vertdf_dir["num Flights"].unique():
for j in vertdf_dir.fix.unique():
meandf_dir.loc[k,"NumFlights"] = i
meandf_dir.loc[k,"fix"] = j
meandf_dir.loc[k,"delay"] = vertdf_dir[(vertdf_dir["num Flights"]==i) & (vertdf_dir.fix==j)].mean().Delay
k += 1
sns.catplot(data=vertdf_dir, x="fix", y="Delay", hue="num Flights", kind="box", showmeans=True)
In the plot I would like to show a trend where for each "num Flights", as fix increases delay goes down.
Is there a way I can draw a line connecting the mean values(green triangles) for each "num flights"?
The questions mentioned here, here and here talk about adding lineplots for the boxplots. The category function creates problem like shown in these undesirable plots.