title: Python - Matplotlib: normalize axis when plotting a Probability Density Function
body: <p>I'm using Python and some of its extensions to get and plot the Probability Density Function. While I manage to plot it, in its form, at least, I don't manage to succeed on scalating the axis.</p>
  
  <pre><code>import decimal
  import numpy as np
  import scipy.stats as stats
  import pylab as pl
  import matplotlib.pyplot as plt
  from decimal import *
  from scipy.stats import norm
  
  lines=[]
  
  fig, ax = plt.subplots(1, 1)
  mean, var, skew, kurt = norm.stats(moments='mvsk')
  
  #Here I delete some lines aimed to fill the list with values
  
  Long = len(lines)
  Maxim = max(lines) #MaxValue
  Minim = min(lines) #MinValue
  av = np.mean(lines) #Average
  StDev = np.std(lines) #Standard Dev.
  
  x = np.linspace(Minim, Maxim, Long)
  ax.plot(x, norm.pdf(x, av, StDev),'r-', lw=3, alpha=0.9, label='norm pdf')
  
  weights = np.ones_like(lines)/len(lines)
  
  ax.hist(lines, weights = weights, normed=True, histtype='stepfilled', alpha=0.2)
  ax.legend(loc='best', frameon=False)
  plt.show()
  </code></pre>
  
  <p>The result is <img src="https://i.stack.imgur.com/OjWIF.png" alt="Plot obtained">  </p>
  
  <p>While I would like to have it expressed 
    - In the x-axis centered in 0 and related to the standard deviation
    - In the y-axis, related to the histogram and the %s (normalized to 1)<br>
      For the x-axis as the image below
  <img src="https://i.stack.imgur.com/25NON.png" alt="Plot wished">     </p>
  
  <p>And like this last image for the y-axis 
  <img src="https://i.stack.imgur.com/1G8BE.png" alt="Y-axis wished"></p>
  
  <p>I've managed to escalate the y-axis in a histogram by plotting it individually with the instruction <em>weights = weights</em> and setting it into the plot, but I can't do it here. I include it in the code but actually it does nothing in this case.</p>
  
  <p>Any help would be appreciated</p>