Skip to content

Instantly share code, notes, and snippets.

@Ze1598
Created January 15, 2020 19:57
Show Gist options
  • Save Ze1598/2f3ab0fa80ae306772861bb786971633 to your computer and use it in GitHub Desktop.
Save Ze1598/2f3ab0fa80ae306772861bb786971633 to your computer and use it in GitHub Desktop.
Matplotlib intro: horizontal bar chart
from matplotlib import pyplot as plt
pairs_owned = [16, 9, 9, 6]
options = ["One", "Two", "Three", "Four+"]
plt.barh(options, pairs_owned)
plt.title("Years of experience working with Python (n=40)")
plt.xlabel("Number of respondents")
plt.tight_layout()
plt.savefig("bar_hor_chart_demo.png")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment