Site de Jean-Michel RICHER

Maître de Conférences en Informatique à l'Université d'Angers

Ce site est en cours de reconstruction certains liens peuvent ne pas fonctionner ou certaines images peuvent ne pas s'afficher.


Code

Fichier : ens/l1/python1/cc/dessine_chemin.py




Warning: Undefined variable $highlight in /home/jeanmichel.richer/public_html/rendu_code.php on line 43
import matplotlib.pyplot as plt

def main():
    chemin = [(0, 0), (1, 0), (1, 1), (1, 2), (0, 2), (0, 3), (1, 3), (2, 3), (3, 3)]
    vx = []
    vy = []
    for (y,x) in chemin:
        vx.append(x+1)
        vy.append(4-y)
   
   
    plt.ylabel("y")
    plt.xlabel("x")
    plt.plot(vx, vy)
    plt.scatter(vx, vy, color='red',s=60)
   
   
    plt.show()

if __name__ == "__main__":
    main()