1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
| import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.font_manager as fm
# Create data
data = {
"Performance expectancy": [1, 0.712, 0.687, 0.651, 0.451, 0.743, 0.646, 0.696, 0.684],
"Effort expectancy": [0.712, 1, 0.745, 0.731, 0.499, 0.701, 0.618, 0.745, 0.665],
"Facilitating conditions": [0.687, 0.745, 1, 0.817, 0.544, 0.781, 0.766, 0.713, 0.801],
"Social influence": [0.651, 0.731, 0.817, 1, 0.602, 0.757, 0.691, 0.744, 0.759],
"Perceived risk": [0.451, 0.499, 0.544, 0.602, 1, 0.57, 0.593, 0.589, 0.576],
"Hedonic motivation": [0.743, 0.701, 0.781, 0.757, 0.57, 1, 0.752, 0.806, 0.782],
"Price value": [0.646, 0.618, 0.766, 0.691, 0.593, 0.752, 1, 0.716, 0.834],
"Personal innovativeness": [0.696, 0.745, 0.713, 0.744, 0.589, 0.806, 0.716, 1, 0.779],
"Behavioral intention": [0.684, 0.665, 0.801, 0.759, 0.576, 0.782, 0.834, 0.779, 1]
}
# Convert the data to a DataFrame
df = pd.DataFrame(data, index=["Performance expectancy", "Effort expectancy", "Facilitating conditions", "Social influence", "Perceived risk", "Hedonic motivation", "Price value", "Personal innovativeness", "Behavioral intention"])
# Set the font
plt.rcParams['font.family'] = 'Microsoft YaHei'
# Set the plot size
plt.figure(figsize=(10, 8))
# Draw the heatmap
sns.heatmap(df, annot=True, cmap='coolwarm', center=0, linewidths=0.5, fmt=".3f", cbar_kws={'label': 'Correlation'})
# Set the title
plt.title("Correlation Analysis Heatmap")
# Display the heatmap
plt.show()
|