Commit 6a59c10e authored by Joaquin Torres's avatar Joaquin Torres

Included tight layout for heatmaps for interactions

parent f2ea0da4
...@@ -17,9 +17,18 @@ ...@@ -17,9 +17,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\Joaquín Torres\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [ "source": [
"import pandas as pd\n", "import pandas as pd\n",
"import numpy as np\n", "import numpy as np\n",
...@@ -64,7 +73,7 @@ ...@@ -64,7 +73,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -83,7 +92,9 @@ ...@@ -83,7 +92,9 @@
"\n", "\n",
"# Load names of social and individual attributes\n", "# Load names of social and individual attributes\n",
"soc_var_names = np.load('../01-EDA/results/feature_names/social_factors.npy', allow_pickle=True)\n", "soc_var_names = np.load('../01-EDA/results/feature_names/social_factors.npy', allow_pickle=True)\n",
"ind_var_names = np.load('../01-EDA/results/feature_names/individual_factors.npy', allow_pickle=True)" "ind_var_names = np.load('../01-EDA/results/feature_names/individual_factors.npy', allow_pickle=True)\n",
"# Retrieve attribute names in order\n",
"attribute_names = attribute_names = list(np.load('../01-EDA/results/feature_names/all_features.npy', allow_pickle=True))"
] ]
}, },
{ {
...@@ -275,7 +286,7 @@ ...@@ -275,7 +286,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -284,7 +295,7 @@ ...@@ -284,7 +295,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -295,7 +306,7 @@ ...@@ -295,7 +306,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -320,7 +331,7 @@ ...@@ -320,7 +331,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -333,7 +344,7 @@ ...@@ -333,7 +344,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -368,15 +379,27 @@ ...@@ -368,15 +379,27 @@
" cbar.set_label('Interaction POST - Interaction PRE', labelpad=15, rotation=270, verticalalignment='bottom')\n", " cbar.set_label('Interaction POST - Interaction PRE', labelpad=15, rotation=270, verticalalignment='bottom')\n",
"\n", "\n",
" plt.savefig(f'./results/plots/heatmaps_interactions/DIST_{method_name}.svg', format='svg', dpi=600)\n", " plt.savefig(f'./results/plots/heatmaps_interactions/DIST_{method_name}.svg', format='svg', dpi=600)\n",
" \n", " plt.tight_layout()\n",
" plt.show()" " plt.show()"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"ename": "NameError",
"evalue": "name 'attribute_names' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[8], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m plot_distance_heatmap(dist_matrix, \u001b[43mattribute_names\u001b[49m, soc_var_names, method_name)\n",
"\u001b[1;31mNameError\u001b[0m: name 'attribute_names' is not defined"
]
}
],
"source": [ "source": [
"plot_distance_heatmap(dist_matrix, attribute_names, soc_var_names, method_name)" "plot_distance_heatmap(dist_matrix, attribute_names, soc_var_names, method_name)"
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment