varshitha22 commited on
Commit
8fa56ab
·
verified ·
1 Parent(s): 57ccae9

Update pages/EDA.py

Browse files
Files changed (1) hide show
  1. pages/EDA.py +8 -27
pages/EDA.py CHANGED
@@ -119,25 +119,6 @@ def plot_feature(feature, title):
119
 
120
  st.pyplot(fig)
121
 
122
- # Display selected plot
123
- feature_mapping = {
124
- "Nitrogen Requirement per Crop": "Nitrogen",
125
- "Phosphorus Requirement per Crop": "Phosphorus",
126
- "Potassium Requirement per Crop": "Potassium",
127
- "Temperature Distribution per Crop": "Temperature",
128
- "Humidity Distribution per Crop": "Humidity",
129
- "pH Value Distribution per Crop": "pH_Value",
130
- "Rainfall Distribution per Crop": "Rainfall",
131
- }
132
- viz_option = st.selectbox("Select a feature visualization:", options=list(feature_mapping.keys()))
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
 
142
 
143
 
@@ -153,11 +134,11 @@ ax.pie(
153
  startangle=140, explode=explode, colors=sns.color_palette("rainbow", len(crop_counts)),
154
  textprops={'fontsize': 3} # Decreased label size
155
  )
156
- ax.set_title("Proportion of Crops", fontsize=10)
157
  st.pyplot(fig)
158
 
159
  # Above-Average Nutrient Requirement Crops
160
- st.markdown("#### Crops that require above-average soil nutrients")
161
 
162
  # Calculate average nutrient levels
163
  avg_nitrogen = df['Nitrogen'].mean()
@@ -167,13 +148,13 @@ avg_potassium = df['Potassium'].mean()
167
  # Function to plot bar charts
168
  def plot_nutrient_crops(data, title):
169
  crop_counts = data.value_counts()
170
- fig, ax = plt.subplots(figsize=(3, 1)) # Adjusted plot size for better display
171
  crop_counts.plot(kind='bar', color='skyblue', ax=ax)
172
- ax.set_xlabel('Crops', fontsize=8)
173
- ax.set_ylabel('Count', fontsize=8)
174
  ax.set_title(title, fontsize=10)
175
- ax.tick_params(axis='x', rotation=45, labelsize=6) # Adjust x-axis label size
176
- ax.tick_params(axis='y', labelsize=6) # Adjust y-axis label size
177
  st.pyplot(fig)
178
 
179
  # Plot: Crops in Nutrient-Rich Soil
@@ -205,7 +186,7 @@ st.markdown("""
205
  """, unsafe_allow_html=True)
206
 
207
  # Below-Average Nutrient Requirement Crops
208
- st.markdown("#### Crops that require below-average soil nutrients")
209
 
210
  # Plot: Crops in Nutrient-Poor Soil
211
  less_avg_of_soil_nutrients = df[
 
119
 
120
  st.pyplot(fig)
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
 
124
 
 
134
  startangle=140, explode=explode, colors=sns.color_palette("rainbow", len(crop_counts)),
135
  textprops={'fontsize': 3} # Decreased label size
136
  )
137
+ ax.set_title("Proportion of Crops", fontsize=8)
138
  st.pyplot(fig)
139
 
140
  # Above-Average Nutrient Requirement Crops
141
+ st.markdown("<h2 style='text-align: left; color: #2E86C1;font-size: 23px;'>Crops that require above-average soil nutrients</h2>", unsafe_allow_html=True)
142
 
143
  # Calculate average nutrient levels
144
  avg_nitrogen = df['Nitrogen'].mean()
 
148
  # Function to plot bar charts
149
  def plot_nutrient_crops(data, title):
150
  crop_counts = data.value_counts()
151
+ fig, ax = plt.subplots(figsize=(4, 2)) # Adjusted plot size for better display
152
  crop_counts.plot(kind='bar', color='skyblue', ax=ax)
153
+ ax.set_xlabel('Crops', fontsize=5)
154
+ ax.set_ylabel('Count', fontsize=5)
155
  ax.set_title(title, fontsize=10)
156
+ ax.tick_params(axis='x', labelsize=3) # Adjust x-axis label size
157
+ ax.tick_params(axis='y', labelsize=3) # Adjust y-axis label size
158
  st.pyplot(fig)
159
 
160
  # Plot: Crops in Nutrient-Rich Soil
 
186
  """, unsafe_allow_html=True)
187
 
188
  # Below-Average Nutrient Requirement Crops
189
+ st.markdown("<h2 style='text-align: left; color: #2E86C1;font-size: 23px;'>Crops that require below-average soil nutrients</h2>", unsafe_allow_html=True)
190
 
191
  # Plot: Crops in Nutrient-Poor Soil
192
  less_avg_of_soil_nutrients = df[