how to set matplotlib bar graph width when there is only one data -


I am using matplotlib to generate a graph. There is a problem in creating the bar graph, if the same data exists as shown below, the width of the graph is covering the entire area, even if the width is set. Example:

  x = [3] y = [10] times (x, y, width = 0.2, align = 'center')    

width controls the width of the bar in 'data' units. Graph ranges by default are automatically scaled on your data limits, in which case this is the width of your single bar. You just need axes limitations

  x = [3] y = [10] fig, ax = plt.subplots (1, 1) ax.bar (x, y, width = 0.2) ax.set_xlim (0, 5) plt.show ()    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -