code: def specplot(
      audio,
      vmin=-5,
      vmax=1,
      rotate=True,
      size=512 + 256,
      **matshow_kwargs,
  ):
      """Plot the log magnitude spectrogram of audio."""
      # If batched, take first element.
      if len(audio.shape) == 2:
          audio = audio[0]
  
      logmag = spectral_ops.compute_logmag(
          core.tf_float32(audio), size=size
      )
      if rotate:
          logmag = np.rot90(logmag)
      # Plotting.
      plt.matshow(
          logmag,
          vmin=vmin,
          vmax=vmax,
          cmap=plt.cm.magma,
          aspect="auto",
          **matshow_kwargs,
      )
      plt.xticks([])
      plt.yticks([])
      plt.xlabel("Time")
      plt.ylabel("Frequency")
  
file_path: ddsp/ddsp/training/plotting.py
imports: from ddsp import core
  from ddsp import spectral_ops
  from matplotlib import gridspec
  import matplotlib.pyplot
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 1 for calling a global function with example usage: specplot(audio, vmin, vmax, rotate, size) without return types