Skip to content

Instantly share code, notes, and snippets.

@sizhky
Last active July 26, 2017 11:23
Show Gist options
  • Save sizhky/e96c260e1d35a0e51f0f629c25177c3f to your computer and use it in GitHub Desktop.
Save sizhky/e96c260e1d35a0e51f0f629c25177c3f to your computer and use it in GitHub Desktop.
Matplotlib simple charts
########################################
'''Simple Bar Chart'''
x_axis=['a','b','c']
y_axis=[10,12,11]
fig, ax = plt.subplots(figsize=(20, 8))
ax.set_xticks(range(len(x_axis)))
ax.bar(range(len(x_axis)), y_axis, align='center')
ax.set_xticklabels(x_axis, rotation='vertical')
########################################
'''Simple Histogram'''
fig, ax = plt.subplots(figsize=(20, 6))
ax.set_xticks(range(50))
ax.hist(uinfo.Age, bins=50, range=(5,55))
########################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment