Problème:
Comment changer la taille d’une figure créée à partir de Matplotlib?
Solution:
Utiliser matplotlib.pyplot.figure et jouer sur le paramètre figsize.
Exemple:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Importations. | |
| import matplotlib.pyplot as plt | |
| # Valeurs pour l'exemple. | |
| x = [3, 1, 4, 6, 7] | |
| y = [2, 4, 7, 5, 4] | |
| # Tracé. | |
| plt.scatter(x, y) | |
| plt.show() | |
| fig = plt.figure(figsize=(8, 8)) | |
| plt.scatter(x, y) | |
| plt.show() |



Laisser un commentaire