Page 75 - IPP-12-2025
P. 75

elif chbar == 4:
                                 break
                              else:
                                 print("Invalid choice. Please try again.")
                        elif ch7 == 3:
                           while True:
                              print("Horizontal Bar Plot Sub-Menu")
                              print("1. Forest fire detections in 2021-2022")
                              print("2. Forest fire detections in 2022-2023")
                              print("3. Comparison of both years")
                              print("4. Exit")
                              chbar = int(input("Enter choice: "))
                              if chbar == 1:
                                 if 'Nov 2021 to June 2022' in result.columns:
                                     plt.barh(result.index, result['Nov 2021 to June 2022'],
                                     label="2021-2022 Detections", color="green")
                                     plt.title("Forest Fire Detections (Nov 2021 to June 2022)")
                                     plt.ylabel("States/UTs")
                                     plt.xlabel("Fire Detections")
                                     plt.legend()
                                     plt.show()
                                 else:
                                     print("Column not found.")
                              elif chbar == 2:
                                 if 'Nov 2022 to June 2023' in result.columns:
                                     plt.barh(result.index, result['Nov 2022 to June 2023'],
                                     label="2022-2023 Detections", color="yellow")
                                     plt.title("Forest Fire Detections (Nov 2022 to June 2023)")
                                     plt.ylabel("States/UTs")
                                     plt.xlabel("Fire Detections")
                                     plt.legend()
                                     plt.show()
                                 else:
                                     print("Column not found.")
                              elif chbar == 3:
                                 if 'Nov 2021 to June 2022' in result.columns and 'Nov 2022 to June
                                      2023' in result.columns:
                                     plt.barh(result.index, result['Nov 2021 to June 2022'],
                                     label="2021-2022 Detections", color="green")
                                     plt.barh(result.index, result['Nov 2022 to June 2023'], label=
                                     "2022-2023 Detections", color="yellow", left=result[' Nov 2021
                                     to June 2022'])
                                     plt.title("Comparison of Fire Detections (2021-2023)")
                                     plt.ylabel("States/UTs")
                                     plt.xlabel("Fire Detections")
                                     plt.legend()
                                     plt.show()
                                 else:
                                     print("Required columns not found.")
                              elif chbar == 4:
                                 break
                              else:
                                 print("Invalid choice. Please try again.")
                        elif ch7 == 4:
                           while True:
                              print("Histogram Sub-Menu [5 Bins]")
                              print("1. Forest fire detections in 2021-2022")
   70   71   72   73   74   75   76   77   78   79   80