Let’s see how to generate distribution plot the easiest way in Python.
Distribution plot implementation
To create normal distribution plot the easiest way we will need to import three different Python libraries:
import numpy as np from matplotlib import pyplot as plt from scipy.stats import norm normal_distribution_plot = np.linspace(-4, 4, 50) plt.plot(normal_distribution_plot, norm.pdf(normal_distribution_plot, 0, 1)) plt.title("Normal Distribution by Pythoneo.com") plt.show()
Numpy allows us to create space.
Matplotlib gives us possibility to create a plot itself.
Thanks to scipy we are able to create normal distribution.
That’s how thanks to just 3 functions we create normal distribution plot in Python.