From charlesreid1

(Created page with "=Types of Plots= ==Histogram== <source lang="python"> from matplotlib import rcParams from pylab import * # construct the distribution with a given mean and deviation: # -----...")
 
No edit summary
Line 33: Line 33:




{{Programs}}
{{Math Programs}}


 
[[Category:Python]]
 
[[Category:Computers]]
[[Category:Programs]]

Revision as of 16:26, 28 May 2011

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)