В вашем случае x
- это corrMatrix[['# of Prophages']]
df = pd.DataFrame({'A': np.random.rand(8), 'B': np.random.rand(8)})
corr = df.corr()
x = corr[['A']]
sns.heatmap(x)
corr:
A B
A 1.000000 -0.192375
B -0.192375 1.000000
sns.heatmap (corr ):
![enter image description here](https://i.stack.imgur.com/UGT8o.png)
sns.heatmap (x):
![enter image description here](https://i.stack.imgur.com/lRrZP.png)
Это может помочь вам:
Кредит идет на unutbu
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import seaborn.matrix as smatrix
sns.set()
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
flights = flights.reindex(flights_long.iloc[:12].month)
sns.heatmap(flights)
Результат:
![enter image description here](https://i.stack.imgur.com/M0T2n.png)
columns = [1953]
myflights = flights.copy()
mask = myflights.columns.isin(columns)
myflights.loc[:, mask] = 0
arr = flights.values
vmin, vmax = arr.min(), arr.max()
sns.heatmap(flights, mask=myflights, annot=True, fmt="d", vmin=vmin, vmax=vmax)
Выход:
![enter image description here](https://i.stack.imgur.com/KaqKt.png)
columns = [1953]
myflights = flights.copy()
mask = myflights.columns.isin(columns)
myflights = myflights.loc[:, mask]
arr = flights.values
vmin, vmax = arr.min(), arr.max()
sns.heatmap(myflights, annot=True, fmt="d", vmin=vmin, vmax=vmax)
Выход:
![enter image description here](https://i.stack.imgur.com/cVwkH.png)