Important functions of Matplotlib

Important functions of Matplotlib

Functions Description
plot(x-axis value, y-axis-values) It is used to plot a simple line graph with x-axis value against the y-axis values. show() It is used to display the graph.
title(“string”) It is used to set the title of the plotted graph as specified by the string.
xlabel(“string”) It is used to set the label for the x-axis as specified by the string.
ylabel(“string”) It is used to set the label for y-axis as specified by the string.
figure() It is used to control a figure level attributes.
subplots(nrows,ncol,index) It is used to add a subplot to recent figure.
subtitle(“string”) It adds a common title to the plotted graph specified by the string.
subplots(nrows,ncols,figsize) It provides the simple way to create subplot, in a single call and returns a tuple of a figure and number of axes.
set_title(“string”) It is an axes level method which is used to set the title of the subplots.
bar(categorical variables, values, color) It is used to create a vertical bar graph.
barh(categorical variables, values, color) It is used to create horizontal bar graphs.
legend(loc) It is used to make a legend of the graph.
xtricks(index, categorical variables) It is used to set or get the current tick locations labels of the x-axis.
pie(value, categorical variables) It is used to create a pie chart.
hist(value, number of bins) It is used to create a histogram.
xlim(start value, end value) It is used to set the limit of values of the x-axis.
ylim(start value, end value) It is used to set the limit of values of the y-axis.
scatter(x-axis values, y-axis values) It is used to plots a scatter plot with x-axis value against the y-axis values.
axes() It is used to add axes to the recent figure.
set_xlabel(“string”) It is an axes level method which is used to set the x-label of the plot specified as a string.
set_ylabel(“string”) It is used to set the y-label of the plot specified as a string.
scatter3D(x-axis values, y-axis values) It is used to plot a three-dimension scatter plot with x- axis value against the y-axis.
plot3D(x-axis values, y-axis values) It is used to plots a three-dimension line graph with x- axis values against y-axis values.