Created
December 2, 2020 16:10
-
-
Save manmohan24nov/d4d340f0c8edced4282fe33745eef5ef 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(indian_state['name']) | |
| staff = list(indian_state['literacy_rate']) | |
| staff_color = [i * 0.000045 for i in staff] | |
| fig, ax = plt.subplots(figsize=(15, 8), dpi=100) | |
| ax.set_xlim(70, 100) | |
| ax.barh(states, staff,align='center', | |
| # width = 0.5, | |
| color=cm.Blues([i / 0.006 for i in staff_color]) | |
| ) | |
| ax.text(0, 1.08, 'Literacy rate of Indian States', | |
| transform=ax.transAxes, size=22, weight=600, ha='left') | |
| ax.text(0, | |
| -0.1, | |
| 'Source: https://en.wikipedia.org/wiki/List_of_Indian_states_and_union_territories_by_literacy_rate', | |
| transform=ax.transAxes, size=12, weight=600, color='#777777') | |
| ax.text(0, 1.02, 'States Literacy rate (in %)', | |
| transform=ax.transAxes, size=12, weight=600, color='#777777') | |
| ax.xaxis.set_ticks_position('bottom') | |
| ax.tick_params(axis='y', colors='black', labelsize=12) | |
| ax.spines['right'].set_visible(False) | |
| ax.spines['top'].set_visible(False) | |
| plt.xticks(np.arange(70, 100, 5.0)) | |
| plt.tick_params(axis='y',which='both', left=False, top=False, labelbottom=False) | |
| ax.grid(color='black', axis='x', ls = '-', lw = 0.25) | |
| ax.set_axisbelow(True) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment