no way to compare when less than two revisions
Différences
Ci-dessous, les différences entre deux révisions de la page.
Révision précédente | |||
— | teaching:progappchim:pylab_simple [2022/03/08 09:43] (Version actuelle) – villersd | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Pylab ====== | ||
+ | Pylab permet de combiner simplement Matplotlib, NumPy et SciPy, en utilisant une directive d' | ||
+ | < | ||
+ | |||
+ | ===== Exemple ===== | ||
+ | |||
+ | Version " | ||
+ | <note tip> | ||
+ | |||
+ | <code python fonctions-FT-06.py> | ||
+ | # | ||
+ | #-*- coding: utf-8 -*- | ||
+ | # graphes de fonctions et des transformées de Fourier, utilisant pylab | ||
+ | # (donc numpy, scipy, matplotlib, | ||
+ | # la directive d' | ||
+ | # les namespaces plt. fft., np.,... | ||
+ | |||
+ | from pylab import * | ||
+ | |||
+ | def f1(t): | ||
+ | f = sin(pi*2.*t) | ||
+ | return f | ||
+ | |||
+ | x = arange(0.0, | ||
+ | y1 = f1(x) | ||
+ | z1=fft(y1) | ||
+ | w1 = abs(z1[: | ||
+ | |||
+ | # doc subplot : http:// | ||
+ | subplot(1, | ||
+ | title(' | ||
+ | plot(x,y1) | ||
+ | xlabel(" | ||
+ | ylabel(" | ||
+ | |||
+ | subplot(1, | ||
+ | title(u' | ||
+ | plot(w1) | ||
+ | xlabel(" | ||
+ | ylabel(" | ||
+ | |||
+ | savefig(' | ||
+ | show() | ||
+ | </ |