Created
December 2, 2020 16:04
-
-
Save manmohan24nov/38e9b97cfcd8133b78e45f366984969f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| states = list(reddit_subgroup_df['subgroup']) | |
| staff = list(reddit_subgroup_df['count']) | |
| fig, ax = plt.subplots(figsize=(15, 8), dpi=400) | |
| x = np.arange(len(states)) # the label locations | |
| width = 0.35 # the width of the bars | |
| rects1 = ax.bar(states, staff, width) | |
| plt.rcParams.update({'font.size': 10}) | |
| rects = ax.patches | |
| def autolabel(rects): | |
| """Attach a text label above each bar in *rects*, displaying its height.""" | |
| for rect in rects: | |
| height = rect.get_height() | |
| ax.annotate('{}'.format(height), | |
| xy=(rect.get_x() + rect.get_width()/2, height), | |
| ha='center', va='bottom') | |
| autolabel(rects1) | |
| ax.text(0, 1.08, 'Sentiment Analysis of Reddit Subgroup', | |
| transform=ax.transAxes, size=22, weight=600, ha='left') | |
| ax.text(0, -0.1, 'Source: Reddit subgroup Comments (https://www.reddit.com/)', | |
| transform=ax.transAxes, size=12, weight=200, color='#777777') | |
| ax.text(0, 1.02, 'Count of Positive comments', | |
| transform=ax.transAxes, size=12, weight=600, color='#777777') | |
| ax.xaxis.set_ticks_position('bottom') | |
| ax.tick_params(axis='x', colors='black', labelsize=12) | |
| ax.spines['right'].set_visible(False) | |
| ax.spines['top'].set_visible(False) | |
| ax.xaxis.set_label_coords(.9, -0.05) | |
| plt.tick_params(axis='y',which='both', left=False, top=False, labelbottom=False) | |
| ax.set_axisbelow(True) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment