Skip to content

Commit 979a26f

Browse files
Merge pull request #2190 from lucifertrj:audio_change
PiperOrigin-RevId: 514691777
2 parents 9b5b8b0 + c2e7ca5 commit 979a26f

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

site/en/tutorials/audio/simple_audio.ipynb

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -322,24 +322,17 @@
322322
},
323323
"outputs": [],
324324
"source": [
325+
"plt.figure(figsize=(16, 10))\n",
325326
"rows = 3\n",
326327
"cols = 3\n",
327328
"n = rows * cols\n",
328-
"fig, axes = plt.subplots(rows, cols, figsize=(16, 9))\n",
329-
"\n",
330329
"for i in range(n):\n",
331-
" if i>=n:\n",
332-
" break\n",
333-
" r = i // cols\n",
334-
" c = i % cols\n",
335-
" ax = axes[r][c]\n",
336-
" ax.plot(example_audio[i].numpy())\n",
337-
" ax.set_yticks(np.arange(-1.2, 1.2, 0.2))\n",
338-
" label = label_names[example_labels[i]]\n",
339-
" ax.set_title(label)\n",
340-
" ax.set_ylim([-1.1,1.1])\n",
341-
"\n",
342-
"plt.show()"
330+
" plt.subplot(rows, cols, i+1)\n",
331+
" audio_signal = example_audio[i]\n",
332+
" plt.plot(audio_signal)\n",
333+
" plt.title(label_names[example_labels[i]])\n",
334+
" plt.yticks(np.arange(-1.2, 1.2, 0.2))\n",
335+
" plt.ylim([-1.1, 1.1])"
343336
]
344337
},
345338
{

0 commit comments

Comments
 (0)