График Hist в Matplotlib возвращает BarContainer, который содержит все свойства barplot.Вы можете перебирать каждый столбец и получать значения 'x' и высоту каждого столбца.
df_age = pd.DataFrame({'AGE': np.random.randint(1,100,200) })
fig,ax = plt.subplots()
plt.hist(df_age['AGE'])
bar_height = []
bar_x = []
bar_x_lst = []
bar_y_lst = []
for bar in ax.patches:
bar_x.append(bar.get_x())
bar_height.append(bar.get_height())
for i,val in enumerate(bar_x):
if i==0:
bar_x_lst.append(val)
continue
bar_x_lst+=[val-0.1,val]
for i,val in enumerate(bar_height):
if i ==len(bar_height)-1:
bar_y_lst.append(val)
continue
bar_y_lst += [val,val]
bar_x_lst.append(bar_x_lst[-1]+bar.get_width())
bar_y_lst.append(bar_y_lst[-1])
bar_y_lst = [i/2 for i in bar_y_lst]
plt.plot(bar_x_lst,bar_y_lst , c= 'red' )
Это вернет что-то вроде этого: 