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

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -