有谁知道如何将参考线图添加到表示每个x值的中位数的kdeplot中。
我试图用汉明滤波器应用卷积来平滑它,但它看起来并不好。
最后,我通过绘图解决了它
# 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:]