Spaces:
Sleeping
Sleeping
Update chart_generation.py
Browse files- chart_generation.py +2 -2
chart_generation.py
CHANGED
|
@@ -17,13 +17,13 @@ def create_bar_plot(file, x_values, y_values):
|
|
| 17 |
plt.xlabel('First Word')
|
| 18 |
plt.ylabel('Count')
|
| 19 |
else:
|
| 20 |
-
count_df = df.groupby(['
|
| 21 |
fig, ax = plt.subplots(figsize=(10, 7))
|
| 22 |
|
| 23 |
count_df.plot(kind='bar', stacked=True, ax=ax)
|
| 24 |
|
| 25 |
|
| 26 |
-
plt.legend(title=
|
| 27 |
|
| 28 |
plt.xlabel(y_values)
|
| 29 |
plt.ylabel('Number of Contributions')
|
|
|
|
| 17 |
plt.xlabel('First Word')
|
| 18 |
plt.ylabel('Count')
|
| 19 |
else:
|
| 20 |
+
count_df = df.groupby(['Simple_Source', y_values]).size().unstack(fill_value=0)
|
| 21 |
fig, ax = plt.subplots(figsize=(10, 7))
|
| 22 |
|
| 23 |
count_df.plot(kind='bar', stacked=True, ax=ax)
|
| 24 |
|
| 25 |
|
| 26 |
+
plt.legend(title=y_values, bbox_to_anchor=(1.05, 1), loc='upper left')
|
| 27 |
|
| 28 |
plt.xlabel(y_values)
|
| 29 |
plt.ylabel('Number of Contributions')
|