This commit is contained in:
Vitor Santos Costa
2016-08-25 12:10:33 -05:00
parent f12349993b
commit e157740bda
9 changed files with 719 additions and 10 deletions

View File

@@ -5,9 +5,35 @@ main :-
Plt = matplotlib.pyplot,
:= import( Plt ),
:= (
Plt.figure(figsize=(10,2.5))
Plt.figure(figsize=(10,2.5)),
Plt.plot([1,2,3,4]),
Plt.ylabel(`some numbers`),
Plt.show()
).
main2 :-
:= ( import( numpy),
import( matplotlib.mlab),
import( matplotlib.pyplot) ),
NP = numpy,
Mlab = matplotlib.mlab,
Plt = matplotlib.pyplot,
% example data
mu := 100, % mean of distribution,
sigma := 15, % standard deviation of distribution,
x := mu + sigma * NP.random.randn(10000),
num_bins := 50,
% the histogram of the data
(n, bins, patches) := Plt.hist(x, num_bins, normed=1, facecolor= `green`, alpha=0.5),
% add a `best fit` line
y := Mlab.normpdf(bins, mu, sigma),
:= (Plt.plot(bins, y, `r--`),
Plt.xlabel(`Smarts`),
Plt.ylabel(`Probability`),
Plt.title(`Histogram of IQ: $\\mu=100$, $\\sigma=15$`),
% Tweak spacing to prevent clipping of ylabel,
Plt.subplots_adjust(left=0.15),
Plt.show()).