Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 9, 2020 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/a8ba61cad9323c0d50034561b9a20195 to your computer and use it in GitHub Desktop.
Save codecademydev/a8ba61cad9323c0d50034561b9a20195 to your computer and use it in GitHub Desktop.
Codecademy export
import codecademylib
from matplotlib import pyplot as plt
drinks = ["cappuccino", "latte", "chai", "americano", "mocha", "espresso"]
sales1 = [91, 76, 56, 66, 52, 27]
sales2 = [65, 82, 36, 68, 38, 40]
#Paste the x_values code here
n = 1 # This is our first dataset (out of 2)
t = 2 # Number of datasets
d = 6 # Number of sets of bars
w =0 # Width of each bar
store1_x = [t*element + w*n for element
in range(d)]
plt.bar(store1_x,sales1)
n=2
t=2
d=len(sales1)
w= 0.8
store2_x=[t*x +w for x in range(d)]
plt.bar(store2_x,sales2)
plt.title('Sales of drink at 2 store locations by types')
plt.xlabel('Drinks')
plt.ylabel('Sales')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment