redfernstech commited on
Commit
66fd6d4
·
verified ·
1 Parent(s): 546f4f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -80,27 +80,27 @@ elif option == "Plots":
80
  colors=plt.cm.Paired.colors # Optional: Change colors for better aesthetics
81
  )
82
 
83
- ax2.axis('equal') # Equal aspect ratio ensures the pie chart is circular.
84
 
85
- # Customize the text labels
86
  for text in texts:
87
  text.set_fontsize(10) # Adjust font size for labels
88
  for autotext in autotexts:
89
  autotext.set_color('white') # Change the color of the percentage text
90
  autotext.set_fontsize(10) # Adjust font size for percentage
91
 
92
- # Add a legend to the right of the pie chart
93
  ax2.legend(wedges, category_counts.index, title="Job Categories", loc="center left", bbox_to_anchor=(1, 0, 0.5, 1))
94
 
95
  st.pyplot(fig2)
96
 
97
 
98
 
99
- # 4. Top Job Titles Bar Plot
100
  st.subheader("Top Job Titles")
101
  top_job_titles = jobs_df[job_title_column].value_counts().head(10)
102
 
103
- # Create the bar plot
104
  fig4, ax4 = plt.subplots(figsize=(10, 6)) # Adjust figure size for better readability
105
  bars = ax4.bar(top_job_titles.index, top_job_titles.values, color='lightcoral')
106
 
@@ -109,12 +109,12 @@ elif option == "Plots":
109
  ax4.set_title("Top 10 Job Titles")
110
  plt.xticks(rotation=45, ha="right")
111
 
112
- # Add labels on the right side of the bars
113
  for bar in bars:
114
  yval = bar.get_height()
115
  ax4.text(bar.get_x() + bar.get_width() / 2, yval, int(yval),ha='center', va='bottom', color='black') # Centered above the bar
116
 
117
- # Adjust layout to give space for labels
118
  plt.subplots_adjust(right=0.85) # Adjust right margin for space
119
 
120
  st.pyplot(fig4)
 
80
  colors=plt.cm.Paired.colors # Optional: Change colors for better aesthetics
81
  )
82
 
83
+ ax2.axis('equal') # Equal aspect ratio ensures the pie chart is circular.
84
 
85
+ # Customize the text labels
86
  for text in texts:
87
  text.set_fontsize(10) # Adjust font size for labels
88
  for autotext in autotexts:
89
  autotext.set_color('white') # Change the color of the percentage text
90
  autotext.set_fontsize(10) # Adjust font size for percentage
91
 
92
+ # Add a legend to the right of the pie chart
93
  ax2.legend(wedges, category_counts.index, title="Job Categories", loc="center left", bbox_to_anchor=(1, 0, 0.5, 1))
94
 
95
  st.pyplot(fig2)
96
 
97
 
98
 
99
+ # 4. Top Job Titles Bar Plot
100
  st.subheader("Top Job Titles")
101
  top_job_titles = jobs_df[job_title_column].value_counts().head(10)
102
 
103
+ # Create the bar plot
104
  fig4, ax4 = plt.subplots(figsize=(10, 6)) # Adjust figure size for better readability
105
  bars = ax4.bar(top_job_titles.index, top_job_titles.values, color='lightcoral')
106
 
 
109
  ax4.set_title("Top 10 Job Titles")
110
  plt.xticks(rotation=45, ha="right")
111
 
112
+ # Add labels on the right side of the bars
113
  for bar in bars:
114
  yval = bar.get_height()
115
  ax4.text(bar.get_x() + bar.get_width() / 2, yval, int(yval),ha='center', va='bottom', color='black') # Centered above the bar
116
 
117
+ # Adjust layout to give space for labels
118
  plt.subplots_adjust(right=0.85) # Adjust right margin for space
119
 
120
  st.pyplot(fig4)