From charlesreid1

Revision as of 16:26, 28 May 2011 by Admin (talk | contribs)

Types of Plots

Histogram

from matplotlib import rcParams
from pylab import *

# construct the distribution with a given mean and deviation:
# -----------------------------------------------------------

# mu = mean
# sigma = standard deviation
# randn(10000) creates an array of size 10,000 x 1 that contains random numbers
mu, sigma = 0, 0.5
x = mu + sigma*randn(10000)

# plot the histogram of the data:
# --------------------------

figure(1)

# this will plot the data with the y-axis as the total number of samples (i.e. 350+)
#n, bins, patches = hist(x, 100,)
# this will plot the histogram with a normalized y-axis
n, bins, patches = hist(x, 100, normed=1)