Here is the explanation of the code:
- plt.ylabel('histogram', labelpad=20) plots ylable as 'histogram' and places it away by 20 units from the y axis spine.
- This is required when yticklabels are long so that ylabel does not overlap with yticklabels.
- However, this may lead to truncation when the figure is saved, as can be seen in the following images, again extracted from the respective output files generated by this code.
The preceding code generates the following output: