Page 460 - AI Ver 3.0 class 10_Flipbook
P. 460
• plt.plot(kind='line')will make a line graph. We can have the following values of the kind parameter to change the
type of the graph needed to make.
Arguments accepted by kind for different plots
kind = Plot type
line Line plot (default)
bar Vertical bar plot
barh Horizontal bar plot
hist Histogram
box Boxplot
area Area plot
pie Pie plot
scatter Scatter plot
List of Pyplot functions to plot different charts and customise plots
• The scatter(x, y) function will plot a scatter graph.
• The show() function will display the figure created.
• The savefig(filename) function can be used to save the figure in your computer.
• The xlabel(Text) function is used to give label to x axis.
• The ylabel(Text) function is used to give label to y axis.
• The title(Text) function is used to give title to a graph created.
• The grid(True)function will add a grid to the graph created. Default is True. If you want grid on x-axis the the
function will be: grid(axis = 'x')and for y axis grid(axis = 'y').
• The xticks(values) function will mark the ticks/points on the x axis.
• The yticks(values) function will mark the ticks/points on the y axis.
Markers
A marker is any symbol that represents a data value in a line chart or a scatter plot. Few of the Markers for the
graph are listed below:
Marker Symbol Description Marker Symbol Description
"·" Point "8" octagon
"," Pixel "s" square
"0" Circle "p" pentagon
"v" triangle_down "p" plus (filled)
"^" triangle_up "*" star
458 Touchpad Artificial Intelligence (Ver. 3.0)-X

