I am plotting three different series on top of each other in Matplotlib using plt.hist(). The goal of creating these histograms is to show the shape of the distribution of values in a data set. One histogram shows the distribution of all the points in the set, which range between 0 and 1, in bins of 0.1. The second and third show a distribution of a subset of data across the same bins. I'd like to be able to see if a subset of data is biased towards the left or the right of center using this.
Instead of a stacked histogram, I would like a layered histogram. This means that the bars will sit over one another. This presents a challenge - how do I order the layers so that the tallest bar is in the back and the shortest bar is in the front? The subsets of data will be smaller than all the data of course, so it would make sense to put the total in the back, but while one subset might contain a larger number of points than the other each specific bin may vary as to which is bigger.
Here is a current example using the code I have provided below:

As you can see, the Cloud contains a smaller number of total points but in the [0.3, 0.4) and [0.4, 0.5) bins there are more than in the Sheath bin, obscuring it.
I am looking for a way to change the order of the bars so that depending on whichever is smaller, it always ends up on top.
Here is what I have so far:
bins = np.arange(0, 1.1, 0.1)
sheath_data = var_data[var_data['Classification'].str.contains("sh")][var_data.columns[int(header_name)]]
cloud_data = var_data[var_data['Classification'].str.contains("cloud")][var_data.columns[int(header_name)]]
# Create histogram
fig, ax = plt.subplots(figsize=(8,6))
plt.hist(selected_metric, bins=bins, edgecolor='black', label='Total')
plt.hist(sheath_data, bins=bins, edgecolor='black', label='Sheath')
plt.hist(cloud_data, bins=bins, edgecolor='black', label='Cloud')
plt.xlabel('Correlation Coef.')
plt.ylabel('Count')
plt.title(f'Distribution in {var_data.columns[int(header_name)]} correlation for {label_dict[subfolder_list[int(var)]]} on {event_date}' )
txt = 'Histograms overlaid on top of each other. In this case, the blue "Total" histogram represents all points in the data set.'
ax.text(0.01, 0.825, f'Total points: {len(selected_metric)} \nTotal in Sheath: {len(sheath_data)} \nTotal in Cloud: {len(cloud_data)}', color='black', ha='left', va='top',transform=ax.transAxes)
plt.figtext(0.5, 0.01, txt, wrap=True, horizontalalignment='center', fontsize=8)
plt.legend(loc='upper left')
plt.xticks(np.arange(0, 1.1, 0.1))
plt.gca().yaxis.set_minor_locator(ticker.MultipleLocator(50))
plt.savefig(f'../../plots/barplots/{event_date}-{var_data.columns[int(header_name)]}-{subfolder_list[int(var)]}.jpg')
plt.show()