File:Rose des vents exemple Python.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 540 × 360 pixels, file size: 44 KB)

Captions

Captions

Wind rose with dummy data, used as an example of creation of a plot with the Python/Matplotlib language

Summary[edit]

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
 
This W3C-invalid plot was created with Matplotlib.
#!/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[edit]

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.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:48, 14 March 2023Thumbnail for version as of 12:48, 14 March 2023540 × 360 (44 KB)Cdang (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata