I have two blocks of code and two graphs:
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import math
import seaborn as sns
mu = 0
variance = 1
sigma = math.sqrt(variance)
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
plt.plot(x, stats.norm.pdf(x, mu, sigma))
plt.show()
In this first block of code I am plotting a normal distribution given the mean and standard deviation. The result is this:
Then I have the other block of code in order to draw a random sample from a normal distribution (in my case, but it could be any other distribution and I would be answering the same question).
value = np.random.normal(loc=mu ,scale=,size=1000)
sns.histplot(value)
Then I plot it and it's like this
I tried to write the code in the same cell but it shows only the histogram.
My question is: is it possible to "merge" the two graphs? I mean, plotting the standard normal distribution of the first block of code on top of the histogram plot, in order to have only one graph and compare visually how close your histogram is to a standard normal distribution?