2

I'm trying to plot a correlation matrix.Like this one On the one side, there should be a graph scatter plot, on the other side the correlation value of two crossed values.

All I know is the pair grid from seaborn. But it doesn't show the correlation value, it has only scatter plot.enter image description here

Maybe somebody knows Python equivalent of the R ?

    library(PerformanceAnalytics)
    chart.Correlation(mydata)  
rdhd
  • 85
  • 1
  • 1
  • 9
  • Thanks, but there is no type of graph that I want. – rdhd Aug 01 '19 at 09:41
  • 2
    This [question](https://stackoverflow.com/questions/48139899/correlation-matrix-plot-with-coefficients-on-one-side-scatterplots-on-another) should answer – Alexandre B. Aug 01 '19 at 09:43

1 Answers1

0

If you are using pandas, you can easily use df.corr() :

import pandas as pd
import numpy as np

data = np.random.rand(10,10)
df = pd.DataFrame(data) # Your data 
corr = df.corr() # Calculates correlation matrix

If you are using jupyter:

corr.style.background_gradient(cmap='coolwarm') # This line plots nicely visualized matrix of correlation

Or using matplotlib

import matplotlib.pyplot as plt
plt.matshow(corr)