Add source example files
This commit is contained in:
21
source/plotting/charts/bar_chart.py
Normal file
21
source/plotting/charts/bar_chart.py
Normal file
@ -0,0 +1,21 @@
|
||||
from typing import Iterable
|
||||
|
||||
from matplotlib import pyplot as plot
|
||||
from matplotlib.axes import Axes
|
||||
from matplotlib.figure import Figure
|
||||
import matplotlib
|
||||
|
||||
if __name__ == '__main__':
|
||||
matplotlib.use("QtCairo")
|
||||
labels: Iterable[str] = ("Janvier", "Février", "Mars", "Avril")
|
||||
values: Iterable[float] = (50, 11.4, 91, 66.1)
|
||||
figure: Figure
|
||||
axis: Axes
|
||||
figure, axis = plot.subplots(nrows=1, ncols=1)
|
||||
axis.bar(x=labels, height=values, color="#00ff00")
|
||||
circle = plot.Circle((2, 20), 2, color="#FF0000", fill=False)
|
||||
axis.set_ylabel("Précipitations (mm)")
|
||||
axis.set_xlabel("Mois")
|
||||
axis.set_title("Précipitations pour 2022")
|
||||
axis.add_artist(circle)
|
||||
plot.show()
|
Reference in New Issue
Block a user