Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def histogram(input1=1, input2=2,input2_random=False):
- fig, ax = plt.subplots(figsize=(10,5))
- groups1 = np.array(load_cache_kmeans(kmeans_input = input1)["2"]["cluster_numbers"])
- if input2_random:
- groups2 = np.random.randint(2,size=(1000,1000))+1
- else:
- groups2 = np.array(load_cache_kmeans(kmeans_input = input2)["2"]["cluster_numbers"])
- OneOne = 0
- OneTwo = 0
- TwoOne = 0
- TwoTwo = 0
- for z in np.arange(0,1000,1):
- for y in np.arange(0,1000,1):
- if groups1[y][z] == 1 and groups2[y][z] == 1:
- OneOne += 1
- if groups1[y][z] == 1 and groups2[y][z] == 2:
- OneTwo += 1
- if groups1[y][z] == 2 and groups2[y][z] == 1:
- TwoOne += 1
- if groups1[y][z] == 2 and groups2[y][z] == 2:
- TwoTwo += 1
- labels = ["1 & 1", "1 & 2", "2 & 1", "2 & 2"]
- visitors = (OneOne,OneTwo,TwoOne,TwoTwo)
- index = np.arange(4)
- bar_width = 0.9
- plt.bar(index, visitors, bar_width, color="green")
- plt.xticks(index, labels) # labels get centered
- plt.show()
- histogram()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement