File:Rose des vents exemple Python.svg

Summary

Description
Français : Rose des vents avec des données arbitraires, utilisé pour un exemple de création de graphique avec le langage Python/Matplotlib.
English: Wind rose with dummy data, used as an example of creation of a plot with the Python/Matplotlib language.
Date
Source Own work. Data extracted from: https://services.meteofrance.com/climatologie/ROSE-DES-VENTS/rose-des-vents
Author Cdang
#!/usr/bin/python3

import numpy as np
import matplotlib.pyplot as plt

# **************
# * Constantes *
# **************

# positions angulaires
angles = 2*np.pi*np.linspace(0, 1, 9) # huitièmes de cercle
radDeg = 180/np.pi # conversion radians → degrés

etoile = np.array([1, 0.2, 1, 0.2, 1, 0.2, 1, 0.2, 1]) # Tracé de l'étoile
vents = np.array([2.85, 3.34, 5.2, 4.025, 4.9, 9.63, 7.5, 2.35, 2.85]) # Fréquence (unité arbitraire)
vents = vents/vents.max() # normalisation

# ***********
# * Traçage *
# ***********

courbes = plt.polar(angles, etoile, angles, vents) # tracé

# mise en forme
axes = plt.gca()
courbes[0].set(color="gray")
courbes[1].set(color="b", label="Fréquence des vents")
plt.legend(bbox_to_anchor=(1.45, 1.05), loc="upper right") # affichage à l'extérieur du tracé
axes.set_rticks([0.2, 0.4, 0.6, 0.8, 1]) # graduations radiales
axes.set_thetagrids(angles=radDeg*angles[0:-1], labels=("E", "NE", "N", "NO", "O", "SO", "S", "SE")) # graduations angulaires
plt.title("Rose des vents", va="bottom")

plt.savefig("rose_des_vents.svg", format="svg")

plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Rose%20des%20vents%20exemple%20Python.svgCategory:Self-published work
Category:Wind roses Category:Matplotlib
Category:CC-BY-SA-4.0 Category:Invalid SVG created with Matplotlib Category:Matplotlib Category:Self-published work Category:Wind roses