title: python - spectrogram divide by zero encountered in log10 warning
body: <p>i tried to generate a spectrogram for each axis in my dataset 
  here what i tried</p>
  
  <pre><code>dataset = np.loadtxt("trainingdataset.txt", delimiter=",", dtype = np.int32)
  
  fake_size = 1415684
  time = np.arange(fake_size)/1415684 # 1kHz
  base_freq = 2 * np.pi * 100
  
  x = dataset[:,2]
  y = dataset[:,3]
  z = dataset[:,4]
  
  xyz_magnitude = x**2 + y**2 + z**2
  
  to_plot = [('x', x), ('y', y), ('z', z), ('xyz', xyz_magnitude)]
  
  for chl, data in to_plot:
      plt.figure(); plt.title(chl)
      d = plt.specgram(data, Fs=1000)
      plt.xlabel('Time [s]'); plt.ylabel('Frequency [Hz]')
      plt.show()
  </code></pre>
  
  <p>but it gives the following warning </p>
  
  <pre><code>Warning (from warnings module):
    File "C:\Users\hadeer.elziaat\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\axes\_axes.py", line 7221
      Z = 10. * np.log10(spec)
  RuntimeWarning: divide by zero encountered in log10
  </code></pre>
  
  <p>the dataset headers 
  (patient number, time/millisecond, x-axis, y-axis, z-axis, label)</p>
  
  <pre><code>1,15,70,39,-970,0
  1,31,70,39,-970,0
  1,46,60,49,-960,0
  1,62,60,49,-960,0
  1,78,50,39,-960,0
  1,93,50,39,-960,0
  1,109,60,39,-990,0
  </code></pre>