Skip to content

Instantly share code, notes, and snippets.

@moyocoyani
Last active December 4, 2020 00:32
Show Gist options
  • Select an option

  • Save moyocoyani/fcf8188500e1d0309a1c7f262ba88e5f to your computer and use it in GitHub Desktop.

Select an option

Save moyocoyani/fcf8188500e1d0309a1c7f262ba88e5f to your computer and use it in GitHub Desktop.
import pandas as pd
#Dataset
cats=["cats","dogs","hamster"]
votes=[134,125,77]
df = pd.DataFrame({'categories':cats,
  'votes': votes})
#Plot----------------------------------
#Canvas
fig,ax = plt.subplots(1,1,figsize=(7.5,13))
#Chart
df.plot.bar(x='categories',y='votes',ax=ax)
#Attributes for plot and axes
ax.set_axisbelow(True)
plt.xticks(rotation=0)
plt.suptitle("Who is the best friend?")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment