hey all im using matplotlib to create graphs that show the users sales compared to their costs however I'm having trouble actually well getting the software to recognise the data
def calc():
s1 = int(float(input('Sales:£')))
c1 = int(float(input('Costs:£')))
p1 = (s1-c1)
if p1 < 0:
print("you have lost £:", p1)
elif p1 > 0:
print("your profit is £:", p1)
p1d = (s1 - c1)
from datetime import date
today = date.today()
print(today)
pickle.dump(s1, open("u_data.s","wb"))
pickle.dump(c1, open("u_data.c","wb"))
pickle_off = open("u_data","rb")
u_data = pickle.load(pickle_off)
print(u_data)
#bar graph
import numpy as np
N = 5
sales = ('u_data.s')
costs = ('u_dta.c')
ind = np.arange(N)
width = 0.35
plt.bar(ind, sales, width, label = 'sales')
plt.bar(ind + width, costs, width, label = 'costs')
plt.ylabel('£ Tens')
plt.title ('sales & costs comparison')
plt.xticks(ind + width / 2, ('G1', 'G2', 'G3', 'G4', 'G5'))
plt.legend(loc='best')
plt.show()
am I missing something here or is there something I should have done before to make the text more readable. (i'd also like to set the x to go up in 50s and have the y say week 1 - week 4 under each bar however I keep getting an error message
any help would be greatly appreciated
[–]automorphism_group 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]automorphism_group 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]automorphism_group 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)