varshitha22 commited on
Commit
7820224
·
verified ·
1 Parent(s): 7935b58

Update pages/EDA.py

Browse files
Files changed (1) hide show
  1. pages/EDA.py +8 -8
pages/EDA.py CHANGED
@@ -468,12 +468,12 @@ st.markdown("""
468
 
469
 
470
 
471
- st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Rainfall vs. Crop</h2>", unsafe_allow_html=True)
472
  fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
473
  sns.scatterplot(data=df, x="Rainfall", y="Crop", hue="Crop", palette="rainbow", legend=False, ax=ax)
474
  ax.set_xlabel("Rainfall (mm)", fontsize=8)
475
  ax.set_ylabel("Crop", fontsize=8)
476
- ax.set_title("Rainfall vs Crop Type", fontsize=7)
477
  st.pyplot(fig)
478
 
479
  st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Temperature vs. Humidity</h2>", unsafe_allow_html=True)
@@ -481,14 +481,14 @@ fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
481
  sns.scatterplot(data=df, x="Temperature", y="Humidity", alpha=0.6, color="blue", ax=ax)
482
  ax.set_xlabel("Temperature (°C)", fontsize=8)
483
  ax.set_ylabel("Humidity (%)", fontsize=8)
484
- ax.set_title("Temperature vs Humidity", fontsize=7)
485
  st.pyplot(fig)
486
 
487
- st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Correlation Heatmap of Soil & Climate Factors</h2>", unsafe_allow_html=True)
488
  corr_matrix = df[['Nitrogen', 'Phosphorus', 'Potassium', 'Temperature', 'Humidity', 'pH_Value', 'Rainfall']].corr()
489
  fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
490
  sns.heatmap(corr_matrix, annot=True, cmap="coolwarm", ax=ax)
491
- ax.set_title("Correlation Heatmap", fontsize=7)
492
  st.pyplot(fig)
493
 
494
  st.markdown("<h2 style='color: #D35400; font-size: 23px;'> 🌾 Crop Recommendations by Season</h2>", unsafe_allow_html=True)
@@ -503,11 +503,11 @@ rainy_crops = df[rainy_conditions]["Crop"].unique().tolist()
503
  winter_crops = df[winter_conditions]["Crop"].unique().tolist()
504
 
505
  # **Display Crop Recommendations**
506
- st.markdown("### ☀ Summer Crops")
507
  st.write(", ".join(summer_crops) if summer_crops else "No crops suitable for summer.")
508
 
509
- st.markdown("### 🌧 Rainy Season Crops")
510
  st.write(", ".join(rainy_crops) if rainy_crops else "No crops suitable for the rainy season.")
511
 
512
- st.markdown("### ❄ Winter Crops")
513
  st.write(", ".join(winter_crops) if winter_crops else "No crops suitable for winter.")
 
468
 
469
 
470
 
471
+ st.markdown("<h2 style='color: #2E86C1; font-size: 23px;'> Rainfall vs. Crop</h2>", unsafe_allow_html=True)
472
  fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
473
  sns.scatterplot(data=df, x="Rainfall", y="Crop", hue="Crop", palette="rainbow", legend=False, ax=ax)
474
  ax.set_xlabel("Rainfall (mm)", fontsize=8)
475
  ax.set_ylabel("Crop", fontsize=8)
476
+ ax.set_title("Rainfall vs Crop Type", fontsize=5)
477
  st.pyplot(fig)
478
 
479
  st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Temperature vs. Humidity</h2>", unsafe_allow_html=True)
 
481
  sns.scatterplot(data=df, x="Temperature", y="Humidity", alpha=0.6, color="blue", ax=ax)
482
  ax.set_xlabel("Temperature (°C)", fontsize=8)
483
  ax.set_ylabel("Humidity (%)", fontsize=8)
484
+ ax.set_title("Temperature vs Humidity", fontsize=5)
485
  st.pyplot(fig)
486
 
487
+ st.markdown("<h2 style='color: #2E86C1; font-size: 23px;'> Correlation Heatmap of Soil & Climate Factors</h2>", unsafe_allow_html=True)
488
  corr_matrix = df[['Nitrogen', 'Phosphorus', 'Potassium', 'Temperature', 'Humidity', 'pH_Value', 'Rainfall']].corr()
489
  fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
490
  sns.heatmap(corr_matrix, annot=True, cmap="coolwarm", ax=ax)
491
+ ax.set_title("Correlation Heatmap", fontsize=5)
492
  st.pyplot(fig)
493
 
494
  st.markdown("<h2 style='color: #D35400; font-size: 23px;'> 🌾 Crop Recommendations by Season</h2>", unsafe_allow_html=True)
 
503
  winter_crops = df[winter_conditions]["Crop"].unique().tolist()
504
 
505
  # **Display Crop Recommendations**
506
+ st.markdown("<h2 style='color: #2E86C1; font-size: 19px;'> ☀ Summer Crops</h2>", unsafe_allow_html=True)
507
  st.write(", ".join(summer_crops) if summer_crops else "No crops suitable for summer.")
508
 
509
+ st.markdown("<h2 style='color: #2E86C1; font-size: 19px;'> 🌧 Rainy Season Crops</h2>", unsafe_allow_html=True)
510
  st.write(", ".join(rainy_crops) if rainy_crops else "No crops suitable for the rainy season.")
511
 
512
+ st.markdown("<h2 style='color: #2E86C1; font-size: 19px;'> ❄ Winter Crops</h2>", unsafe_allow_html=True)
513
  st.write(", ".join(winter_crops) if winter_crops else "No crops suitable for winter.")