21 lines
737 B
Python
21 lines
737 B
Python
import pandas as pd
|
|
from plotly.graph_objs import Figure, Bar, Scatter
|
|
|
|
data = pd.DataFrame(
|
|
data={
|
|
"product": ["tarte", "gâteau", "biscuit", "mille-feuille", "éclair", "brownie"],
|
|
"price": [2.99, 3.49, 1.99, 4.99, 5.99, 6.99],
|
|
"weight": [250, 300, 200, 400, 500, 600],
|
|
}
|
|
)
|
|
figure: Figure = Figure(data=[Bar(name="Prix", x=data["product"], y=data["price"])])
|
|
figure.add_hrect(y0=2.75, y1=4.5, fillcolor="gray", opacity=0.25, layer="below")
|
|
figure.update_layout(
|
|
template="seaborn",
|
|
title="Prix et poids unitaires",
|
|
font={"family": "Cabin", "size": 13},
|
|
xaxis={"title": "Produit", "showgrid": False},
|
|
yaxis={"title": "Prix (€)", "showgrid": False}
|
|
)
|
|
figure.show(renderer="browser")
|