File:Cartes couleur sinFoisSin python matplotlib.svg
Summary
Description |
Français : Fonction z = sin(x) × sin(y) sous la forme de lignes de niveau ou de cartes de couleur, tracée avec Python/Matplotlib.
English: Function z = sin(x) × sin(y) plotted as contour lines or colour maps, by Python/Matplotlib. |
Date | |
Source | Own work |
Author | Cdang |
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2*np.pi, 20)
y = x.copy()
X, Y = np.meshgrid(x, y)
Z = np.sin(X)*np.sin(Y)
fig, liste_axes = plt.subplots(2, 2, constrained_layout=True)
im1 = liste_axes[0, 0].contour(X, Y, Z)
fig.colorbar(im1, ax=liste_axes[0, 0])
im2 = liste_axes[0, 1].contourf(X, Y, Z)
fig.colorbar(im2, ax=liste_axes[0, 1])
im3 = liste_axes[1, 0].pcolormesh(X, Y, Z)
fig.colorbar(im3, ax=liste_axes[1, 0])
plt.savefig("cartes_couleur_sinFoisSin_python_matplotlib.svg", format="svg")
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
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.