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()

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading