title: Normalization to bring in the range of [0,1]
body: <p>I have a huge data set from which I derive two sets of datapoints, which I then have to plot and compare. These two plots differ in their in their range, so I want them to be in the range of <code>[0,1]</code>. For the following code and a specific data set I get a constant line at 1 as the dataset plot, but this normalization works well for other sets:</p>
  <pre><code>plt.plot(range(len(rvalue)),np.array(rvalue)/(max(rvalue)))
  </code></pre>
  <p>and for this code :</p>
  <pre><code>oldrange = max(rvalue) - min(rvalue)  # NORMALIZING
  newmin = 0
  newrange = 1 + 0.9999999999 - newmin
  normal = map(
      lambda x, r=float(rvalue[-1] - rvalue[0]): ((x - rvalue[0]) / r)*1 - 0, 
      rvalue)
  plt.plot(range(len(rvalue)), normal)
  </code></pre>
  <p>I get the error:</p>
  <pre><code>ZeroDivisionError: float division by zero
  </code></pre>
  <p>for all the data sets. I am unable to figure out how to get both the plots in one range for comparison.</p>