Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,9 +48,12 @@ elif option == "Plots":
|
|
48 |
st.subheader("Job Category Distribution")
|
49 |
category_counts = jobs_df[category_column].value_counts()
|
50 |
|
|
|
|
|
|
|
51 |
# Create the bar plot
|
52 |
fig1, ax1 = plt.subplots(figsize=(10, 6)) # Set figure size
|
53 |
-
bars = ax1.bar(category_counts.index, category_counts.values, color=
|
54 |
|
55 |
ax1.set_xlabel("Job Category")
|
56 |
ax1.set_ylabel("Number of Jobs")
|
@@ -61,6 +64,8 @@ elif option == "Plots":
|
|
61 |
legend_labels = [f"{category}: {int(count)}" for category, count in zip(category_counts.index, category_counts.values)]
|
62 |
ax1.legend(bars, legend_labels, title="Job Categories", loc="upper left", bbox_to_anchor=(1, 1)) # Position the legend
|
63 |
|
|
|
|
|
64 |
# Adjust layout to give space for the legend
|
65 |
plt.subplots_adjust(right=0.75) # Adjust right margin for legend space
|
66 |
|
@@ -68,6 +73,7 @@ elif option == "Plots":
|
|
68 |
|
69 |
|
70 |
|
|
|
71 |
# 2. Pie Chart for Category Distribution
|
72 |
st.subheader("Job Category Proportions")
|
73 |
fig2, ax2 = plt.subplots(figsize=(10, 10)) # Adjust the size as needed
|
|
|
48 |
st.subheader("Job Category Distribution")
|
49 |
category_counts = jobs_df[category_column].value_counts()
|
50 |
|
51 |
+
# Create a color palette for the bars
|
52 |
+
colors = plt.cm.Paired.colors # You can choose any colormap you prefer
|
53 |
+
|
54 |
# Create the bar plot
|
55 |
fig1, ax1 = plt.subplots(figsize=(10, 6)) # Set figure size
|
56 |
+
bars = ax1.bar(category_counts.index, category_counts.values, color=colors[:len(category_counts)])
|
57 |
|
58 |
ax1.set_xlabel("Job Category")
|
59 |
ax1.set_ylabel("Number of Jobs")
|
|
|
64 |
legend_labels = [f"{category}: {int(count)}" for category, count in zip(category_counts.index, category_counts.values)]
|
65 |
ax1.legend(bars, legend_labels, title="Job Categories", loc="upper left", bbox_to_anchor=(1, 1)) # Position the legend
|
66 |
|
67 |
+
# No text labels on the bars and no labels above the bars
|
68 |
+
|
69 |
# Adjust layout to give space for the legend
|
70 |
plt.subplots_adjust(right=0.75) # Adjust right margin for legend space
|
71 |
|
|
|
73 |
|
74 |
|
75 |
|
76 |
+
|
77 |
# 2. Pie Chart for Category Distribution
|
78 |
st.subheader("Job Category Proportions")
|
79 |
fig2, ax2 = plt.subplots(figsize=(10, 10)) # Adjust the size as needed
|