Last active
December 4, 2020 00:32
-
-
Save moyocoyani/fcf8188500e1d0309a1c7f262ba88e5f 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
| 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