У меня есть два вектора (r1 и r2) длиной 3500, и я хочу сравнить их. Проблема в том, что когда я использую plt.bar
, я получаю два разных типа графика для r2. Как это возможно?

Может кто-нибудь сказать мне, что не так в моем коде?
def compare_representations(r1, r1title, r2, r2title, image, k):
ka = np.asarray(range(k)) #ka =3500
plt.figure(figsize=(13,10))
#histogram Query
hiq = plt.subplot(2,2,1)
hiq.set_title("Histogram for " + r1title)
hiq.set_xlabel("Visual words")
hiq.set_ylabel("Frequency")
#hist1 = plt.plot(r1, color='orangered')
hist1 = plt.bar(ka,r1,width=1.0,color="orangered")
#histogram Image
his = plt.subplot(2,2,2)
his.set_title("Histogram for "+ r2title)
his.set_xlabel("Visual words")
his.set_ylabel("Frequency")
#hist2 = plt.plot(r2, color='mediumslateblue')
hist2 = plt.bar(ka,r2,width=1.0,color='mediumslateblue')
#histograms compared
comp = plt.subplot(2,2,3)
comp.set_title("Compare Histograms: ")
comp.set_xlabel("Visual words")
comp.set_ylabel("Frequency")
#plt.plot(r1, color ='orangered')
#plt.plot(r2, color = 'mediumslateblue')
plt.bar(ka,r1,width=1.0,color ='orangered')
plt.bar(ka,r2,width=1.0,color = 'mediumslateblue')
#plot founded image
ax = plt.subplot(2,2,4)
ax.grid(False)
img = mpimg.imread(image, format='jpeg')
# Turn off tick labels and show just name of founded image
ax.set_yticklabels([])
ax.set_xticklabels([])
ax.set_xlabel(os.path.basename(image))
imgplot = plt.imshow(img)
plt.show()
return(hist1, hist2, imgplot)