|
|
| Line 1: |
Line 1: |
| #REDIRECT [[Matplotlib:Main_Page]] | | #REDIRECT [[Matplotlib:Main_Page]] |
|
| |
|
| |
|
| |
| {{Stub}}
| |
|
| |
| =Types of Plots=
| |
|
| |
| ==Histogram==
| |
|
| |
| <source lang="python">
| |
| 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)
| |
| </source>
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
| {{Programs}}
| |
| {{Math Programs}}
| |
|
| |
|
| [[Category:Python]] | | [[Category:Python]] |