Add source example files
This commit is contained in:
15
source/plotting/plotly-pielabel.py
Normal file
15
source/plotting/plotly-pielabel.py
Normal file
@ -0,0 +1,15 @@
|
||||
import pandas as pd
|
||||
from plotly import express as px
|
||||
|
||||
data = pd.DataFrame(data={
|
||||
"product": ["pomme", "poire", "banane", "pêche"],
|
||||
"price": [1.99, 2.49, 2.99, 3.49], "wpu": [200, 180, 140, 200]
|
||||
})
|
||||
figure = px.pie(data, values="price", names="product", title="Prix")
|
||||
# Afficher le dernier graphique généré
|
||||
figure.layout.update({
|
||||
"template": "seaborn",
|
||||
"title": "Prix au kilo", "font": {"family": "Cabin", "size": 13},
|
||||
})
|
||||
figure.update_traces(**{"textinfo": "label+value", "texttemplate": "%{label}<br>%{value:.2f}€"})
|
||||
figure.show()
|
Reference in New Issue
Block a user