# 图5-6-1 不同类型的相关系数热力图
```python
import numpy as np
import pandas as pd
from plotnine import *
from plotnine.data import mtcars
mat_corr = np.round(mtcars.corr(), 1).reset_index()
mydata = pd.melt(mat_corr, id_vars='index', var_name='var', value_name='value')
mydata['AbsValue'] = np.abs(mydata.value)
mydata
```
```
index var value AbsValue
0 mpg mpg 1.0 1.0
1 cyl mpg -0.9 0.9
2 disp mpg -0.8 0.8
3 hp mpg -0.8 0.8
4 drat mpg 0.7 0.7
.. ... ... ... ...
116 qsec carb -0.7