# Compare number of components:
#
import numpy as np
from matplotlib import pyplot as plt
from nustattools import plotting as nuplt
rng = np.random.default_rng()
x = np.linspace(0, 10, 5)
cov = np.eye(5)
u = x[:,np.newaxis] / 4
for i in range(4):
    u *= 2
    u[0] *= -1
    cov = cov + u@u.T
    u = np.roll(u, i+1)
y = rng.multivariate_normal(np.zeros(5), cov)
nuplt.pcplot(x, y, cov, componentwidth=1.4, components=1, label="1 components")
nuplt.pcplot(x, y, cov, componentwidth=[(0.4,0)], components=2, label="2 components")
nuplt.pcplot(x, y, cov, componentwidth=[(0,0.4)], components=3, label="3 components")
plt.legend()
