[PYTHON] Histogram transparent overlay by Matplotlib

Overwrite a transparent histogram using matplotlib in Python.

histgram.py


import numpy as np
import matplotlib.pyplot as plt
a = np.random.randn(10000)
plt.figure()
plt.hist(a-1, bins=100, alpha=0.3, histtype='stepfilled', color='r')
plt.hist(a+1, bins=100, alpha=0.3, histtype='stepfilled', color='b')
plt.show()

You can adjust the transparency with alpha. 0 is completely transparent. 1 for transparency 0.

Execution result hist.png

Recommended Posts

Histogram transparent overlay by Matplotlib
Histogram with matplotlib
[Scientific / technical calculation by Python] Histogram, visualization, matplotlib
python --Export 2D histogram as an array by Matplotlib
pandas Matplotlib Summary by usage
behavior of matplotlib: histogram normed
Real-time graph display by matplotlib
Histogram parameter excerpt from matplotlib
Add cumulative ratio to matplotlib histogram
Show dividing lines in matplotlib histogram
GUI application by Kivy (including matplotlib)
Write a stacked histogram with matplotlib