Does anyone know how to add a reference lineplot into a kdeplot that represents the median for each x value.
I tried to smoothen it applying a convolution with a hamming filter but it doesn't look to good.
Does anyone know how to add a reference lineplot into a kdeplot that represents the median for each x value.
I tried to smoothen it applying a convolution with a hamming filter but it doesn't look to good.
Finally, I solved it by plotting
# create an aggregation ef
ef = df[['Temp','Power]].groupby('Temp').median().reset_index()
# smooth the aggregation with mean() - shift(- half window) is needed for alignment
ef['roll_med_power'] = ef['Power'].rolling(5).mean().shift(-2)
# finally close the gaps at beginning and end with unsmoothed data
ef['roll_med'][:2] = ef['Power'][:2]
ef['roll_med'][-2:] = ef['Power'][-2:]