gdleds commited on
Commit
2f854dd
·
verified ·
1 Parent(s): 571c5f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -123
app.py CHANGED
@@ -814,129 +814,6 @@ if page == "Exploration des données":
814
 
815
  # Affichage Streamlit
816
  st.plotly_chart(fig)
817
- #---------------------------------------------------- Les 10 départements avec le plus d’incendies -----------------------------------------
818
- # import plotly.graph_objects as go
819
-
820
- # -----------------------------------------------------------
821
- # 🔥 Top-10 des départements par nombre de feux – version GO
822
- # -----------------------------------------------------------
823
- if page == "Exploration des données":
824
- df_temp = df_merge.copy()
825
- df_temp["Département"] = df_temp["Département"].replace(
826
- {"2A": "2A/2B", "2B": "2A/2B"}
827
- )
828
-
829
- df_count = (
830
- df_temp.groupby("Département")
831
- .size()
832
- .reset_index(name="Nombre de feux")
833
- .sort_values("Nombre de feux", ascending=False)
834
- .head(10)
835
- )
836
-
837
- # ── Barres avec labels (Graph Objects)
838
-
839
- y_max = df_count["Nombre de feux"].max()
840
- y_range = [0, y_max * 1.15] # +15% d’espace en haut
841
-
842
- fig_top10_feux = go.Figure(
843
- data=go.Bar(
844
- x=df_count["Département"],
845
- y=df_count["Nombre de feux"],
846
- text=df_count["Nombre de feux"].apply(lambda x: f"{x:,}"),
847
- textposition="outside",
848
- textfont=dict(size=16, color="black"),
849
- marker=dict(
850
- color="#627CFF",
851
- line=dict(color="black", width=1.5),
852
- ),
853
- cliponaxis=False # 🔑 évite le texte coupé
854
- )
855
- )
856
-
857
- fig_top10_feux.update_layout(
858
- title=dict(
859
- text="🔥 Top 10 des départements avec le plus d’incendies",
860
- font=dict(size=20, color="black"),
861
- x=0.5
862
- ),
863
- template="plotly_white",
864
- plot_bgcolor="rgba(245,248,255,1)",
865
- paper_bgcolor="rgba(245,248,255,1)",
866
-
867
- margin=dict(l=90, r=90, t=160, b=130), # 🔑 plus d’espace en haut
868
-
869
- font=dict(
870
- size=16,
871
- color="black" # 🔑 force le noir partout
872
- ),
873
-
874
- xaxis=dict(
875
- title=dict(
876
- text="Département",
877
- font=dict(size=18, color="black")
878
- ),
879
- tickangle=-35,
880
- tickfont=dict(size=16, color="black"),
881
- showline=True,
882
- linewidth=2,
883
- linecolor="black"
884
- ),
885
-
886
- yaxis=dict(
887
- title=dict(
888
- text="Nombre de feux",
889
- font=dict(size=18, color="black")
890
- ),
891
- tickformat=",d",
892
- tickfont=dict(size=16, color="black"),
893
- showline=True,
894
- linewidth=2,
895
- linecolor="black",
896
- rangemode="tozero"
897
- ),
898
-
899
- bargap=0.05
900
- )
901
-
902
- # fig_top10_feux = go.Figure(
903
- # data=go.Bar(
904
- # x=df_count["Département"],
905
- # y=df_count["Nombre de feux"],
906
- # text=df_count["Nombre de feux"].apply(lambda x: f"{x:,}"),
907
- # textposition="outside",
908
- # textfont=dict(size=16, color="black"), # police foncée
909
- # marker=dict(
910
- # color="#627CFF",
911
- # line=dict(color="black", width=1.5),
912
- # ),
913
- # )
914
- # )
915
-
916
- # # ── Mise en page inspirée de ta Fig 1
917
- # fig_top10_feux.update_layout(
918
- # title="🔥 Top 10 des départements avec le plus d’incendies",
919
- # title_font_size=18,
920
- # template="plotly_white", # fond clair + grille
921
- # plot_bgcolor="rgba(245,248,255,1)",
922
- # paper_bgcolor="rgba(245,248,255,1)",
923
- # margin=dict(l=80, r=80, t=140, b=120),
924
- # font=dict(size=16, color="black"), # police par défaut foncée
925
- # xaxis=dict(
926
- # title="Département",
927
- # tickangle=-35,
928
- # tickfont=dict(size=16),
929
- # ),
930
- # yaxis=dict(
931
- # title="Nombre de feux",
932
- # tickformat=",d",
933
- # tickfont=dict(size=16),
934
- # ),
935
- # bargap=0.05,
936
- # )
937
-
938
- st.plotly_chart(fig_top10_feux, use_container_width=True)
939
-
940
 
941
  # ---------------------------------------------------- Page Résultats des modèles -----------------------------------------
942
 
 
814
 
815
  # Affichage Streamlit
816
  st.plotly_chart(fig)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
817
 
818
  # ---------------------------------------------------- Page Résultats des modèles -----------------------------------------
819