Page 73 - IPP-12-2025
P. 73
print("5. Exit to Main Menu")
try:
ch7 = int(input("Enter your choice: "))
except ValueError:
print("Invalid input. Please enter a number.")
continue
if ch7 == 1:
while True:
print("Line 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")
chline = int(input("Enter choice: "))
if chline == 1:
if 'Nov 2021 to June 2022' in result.columns:
plt.plot(result.index, result['Nov 2021 to June 2022'],
label="2021-2022 Detections")
plt.title("Forest Fire Detections (Nov 2021 to June 2022)")
plt.xlabel("States/UTs")
plt.ylabel("Fire Detections")
plt.xticks(rotation=30)
plt.legend()
plt.grid(True)
plt.show()
else:
print("Column not found.")
elif chline == 2:
if 'Nov 2022 to June 2023' in result.columns:
plt.plot(result.index, result['Nov 2022 to June 2023'],
label="2022-2023 Detections")
plt.title("Forest Fire Detections (Nov 2022 to June 2023)")
plt.xlabel("States/UTs")
plt.ylabel("Fire Detections")
plt.xticks(rotation=30)
plt.legend()
plt.grid(True)
plt.show()
else:
print("Column not found.")
elif chline == 3:
if 'Nov 2021 to June 2022' in result.columns and 'Nov 2022 to June
2023' in result.columns:
plt.plot(result.index, result['Nov 2021 to June 2022'],
label="2021-2022")
plt.plot(result.index, result['Nov 2022 to June 2023'],
label="2022-2023", linestyle='--')
plt.title("Comparison of Fire Detections (2021-2023)")
plt.xlabel("States/UTs")
plt.ylabel("Fire Detections")
plt.xticks(rotation=30)
plt.legend()
plt.grid(True)
plt.show()
else:
print("Required columns not found.")