Note LaTeX format in the plot title!
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# random vector with normal distribution
sigma, mu = 2, 10
x = sigma*np.random.standard_normal(10000) + mu
sns.histplot(x, kde=True, bins=50)
# title with LaTeX formatting
plt.title('Histogram with $\mu$={0}, $\sigma$={1}'.format(mu,sigma))
plt.savefig('ex202.png', dpi=72)
plt.show()
Last Updated on 2021-11-23 by gantovnik

Recent Comments