python - Remove spaces between bars in barchart -


i want there no spaces between bars on chart. searched question before posted, , while there variety of answers, none have effect on chart. assume i'm doing wrong, can't figure out how make work.

i tried both of these methods , spaces between bar remained unchanged:

    plt.axis('tight')      bin = np.arange(my_list)     plt.xlim([0, bin.size]) 

here code:

my_list = [2355, 2259, 683] plt.rcdefaults() fig, ax = plt.subplots() width = .35  kitchen = ("cucumber", "legacy", "monkey") y_pos = np.arange(len(kitchen))  barlist = ax.bar(y_pos, my_list, width, align='center', ecolor='black') barlist[0].set_color('dodgerblue') barlist[1].set_color('orangered') barlist[2].set_color('khaki')  def autolabel(rects):     rect in rects:         height = rect.get_height()         ax.text(rect.get_x() + rect.get_width()/2., 1*height,             '%d' % int(height),             ha='center', va='bottom')  autolabel(barlist) plt.title('my bar chart') plt.xlabel("kitchen") plt.ylabel("shoes") plt.xticks(y_pos,("cucumber", "legacy", "monkey",)) plt.show() 

my chart

i able figure solution question. add part in bold, , allowed me adjust size of chart rid of excess white space.

my_list = [2355, 2259, 683] plt.rcdefaults() fig, ax = plt.subplots(**figsize=(3, 3.5)**) width = .35 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -