graphing with matplotlib pyplot this program generates the following grouped bar chart figures and subplots matplotlib figure is the object that contains all the graphical elements displayed on plot that is the axesthe legendthe title as well as the line plot or bar chart itself it thus represents the overall window or page and is the topout graphical component in many cases the figure is implicit as the developer interacts with the pyplot apihowever the figure can be accessed directly if required the matplotlib pyplot figure(function generates figure object this function returns matplotlib figure figure object it is then possible to interact directly with the figure object for example it is possible to add axes to the figureto add sub plots to graph etc working directly with the figure is necessary if you want to add multiple subplots to figure this can be useful if what is required is to be able to compare different views of the same data side by side each subplot has its own axes which can coexist within the figure one or more subplots can be added to figure using the figure add_ subplot(method this method adds an axes to the figure as one of set of one or more subplots subplot can be added using -digit integer (or three separate integersdescribing the position of the subplot the digits represent the number of rowscolumns and the index of the sub plot within the resulting matrix