Posts

How to plot bar graph in Python

Image
A bar plot or bar chart is a graph that represents the category of data with rectangular bars with lengths and heights that is proportional to the values which they represent. The bar plots can be plotted horizontally or vertically. A bar chart describes the comparisons between the discrete categories. One of the axis of the plot represents the specific categories being compared, while the other axis represents the measured values corresponding to those categories. Creating a bar plot The  matplotlib  API in Python provides the  bar()  function which can be used in MATLAB style use or as an object-oriented API. The syntax of the  bar()  function to be used with the axes is as follows:- plt.bar(x, height, width, bottom, align) The function creates a bar plot bounded with a rectangle depending on the given parameters.   Following is a simple example of the bar plot, which represents the number of students enrolled in different courses of an institute. im...