This block of code outputs all 10 of my covariance matrices and plots every point in the 2x2 matrix.
for i in range(10):
columns = datawithoutmean[:, i*2:i*2 + 2]
cov = numpy.cov(columns.T)
print(cov)
matplotlib.pyplot.scatter(cov[:,0], cov[:,1], c = 'r', marker = '.')
matplotlib.pyplot.show()
How can I specifically output the off-diagonal value for each co variance matrix and plot it using pyplot?
For reference the first co variance matrix looks like this:
[[10.34020531 -0.01203439]
[-0.01203439 2.06085007]]
I want to plot the off-diagonal (the co variance between the two columns), so in this case it would be -0.01203439.
Edit: I found out I can get the off-diagonal like this: Ok so If I do this, it'll output the co-variance value between the two columns:
for i in range(10):
columns = datawithoutmean[:, i*2:i*2 + 2]
cov = numpy.cov(columns.T)
off_diagonal = cov[0][1] # covariance value
But how can I plot those values in a scatterplot using pyplot?