|
43 | 43 | },
|
44 | 44 | {
|
45 | 45 | "cell_type": "code",
|
46 |
| - "execution_count": 3, |
| 46 | + "execution_count": null, |
47 | 47 | "metadata": {},
|
48 | 48 | "outputs": [
|
49 | 49 | {
|
|
62 | 62 | "import seaborn as sns\n",
|
63 | 63 | "import numpy as np\n",
|
64 | 64 | "\n",
|
65 |
| - "# Esempio di dati per pc_soap\n", |
66 | 65 | "# pc_soap = np.random.rand(1000, 2) # Sostituire con i propri dati\n",
|
67 | 66 | "plt.scatter(pc_soap[::skip, 0], pc_soap[::skip, 1], s=0.5, color=\"black\", alpha=0.5)\n",
|
68 | 67 | "\n",
|
69 |
| - "# Aggiungere linee di densità\n", |
70 | 68 | "sns.kdeplot(x=pc_soap[::skip, 0], y=pc_soap[::skip, 1], levels=10, color=\"red\", linewidths=1)\n",
|
71 | 69 | "\n",
|
72 | 70 | "plt.title('SOAP PCA components')\n",
|
|
171 | 169 | },
|
172 | 170 | {
|
173 | 171 | "cell_type": "code",
|
174 |
| - "execution_count": 7, |
| 172 | + "execution_count": null, |
175 | 173 | "metadata": {},
|
176 | 174 | "outputs": [
|
177 | 175 | {
|
|
189 | 187 | "import matplotlib.pyplot as plt\n",
|
190 | 188 | "import numpy as np\n",
|
191 | 189 | "\n",
|
192 |
| - "# Esempio di due array con 3 valori ciascuno\n", |
193 | 190 | "array1 = ev * 100\n",
|
194 | 191 | "array2 = ev_10 * 100\n",
|
195 | 192 | "\n",
|
196 |
| - "# Le etichette per le barre\n", |
197 | 193 | "labels = ['PC1', 'PC2', 'PC3']\n",
|
198 | 194 | "\n",
|
199 |
| - "# Posizione delle barre sul grafico\n", |
200 | 195 | "x = np.arange(len(labels))\n",
|
201 | 196 | "\n",
|
202 |
| - "# Larghezza delle barre\n", |
203 | 197 | "width = 0.35\n",
|
204 | 198 | "\n",
|
205 | 199 | "fig, ax = plt.subplots(figsize=(10, 6))\n",
|
206 | 200 | "\n",
|
207 |
| - "# Tracciare le barre per ciascun array\n", |
208 | 201 | "bars1 = ax.bar(x - width/2, array1, width, label='SOAP', color='blue')\n",
|
209 | 202 | "bars2 = ax.bar(x + width/2, array2, width, label='⟨SOAP⟩', color='orange')\n",
|
210 | 203 | "\n",
|
211 |
| - "# Aggiungere annotazioni sopra le barre per il primo array\n", |
212 | 204 | "for bar in bars1:\n",
|
213 | 205 | " yval = bar.get_height()\n",
|
214 | 206 | " ax.text(bar.get_x() + bar.get_width() / 2.0, yval, f'{yval:.2f}', va='bottom', ha='center', fontweight='bold',fontsize=fontsize)\n",
|
215 | 207 | "\n",
|
216 |
| - "# Aggiungere annotazioni sopra le barre per il secondo array\n", |
217 | 208 | "for bar in bars2:\n",
|
218 | 209 | " yval = bar.get_height()\n",
|
219 | 210 | " ax.text(bar.get_x() + bar.get_width() / 2.0, yval, f'{yval:.2f}', va='bottom', ha='center', fontweight='bold',fontsize=fontsize)\n",
|
220 | 211 | "\n",
|
221 |
| - "# Aggiungere etichette, titolo e legenda\n", |
222 | 212 | "ax.set_xlabel('PCA Components', fontweight='bold',fontsize=fontsize)\n",
|
223 | 213 | "ax.set_ylabel('Explained variance (%)', fontweight='bold',fontsize=fontsize)\n",
|
224 | 214 | "ax.set_title('Explained variance', fontsize=fontsize+2)\n",
|
|
0 commit comments