0% found this document useful (0 votes)
13 views1 page

Matplotlib Cheat Sheet Class12

This document is a cheat sheet for Matplotlib, providing essential commands for creating various types of graphs such as line graphs, bar charts, histograms, and pie charts. It includes information on customizing line styles, marker styles, and color codes. The cheat sheet serves as a quick reference for Class 12 IP students using Matplotlib for data visualization.

Uploaded by

sandeepgurusivam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Matplotlib Cheat Sheet Class12

This document is a cheat sheet for Matplotlib, providing essential commands for creating various types of graphs such as line graphs, bar charts, histograms, and pie charts. It includes information on customizing line styles, marker styles, and color codes. The cheat sheet serves as a quick reference for Class 12 IP students using Matplotlib for data visualization.

Uploaded by

sandeepgurusivam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Matplotlib Cheat Sheet (Class 12 IP)

Code Meaning
plt.plot(x,y) Draws a line graph between x and y
plt.title('Name') Adds a title to the graph
plt.xlabel('X-axis') Labels the X-axis
plt.ylabel('Y-axis') Labels the Y-axis
plt.xticks([1,2,3],['A','B','C']) Custom ticks/labels on X-axis
plt.yticks([10,20,30]) Sets Y-axis ticks (scale values)
plt.bar(x,y) Vertical bar chart
plt.barh(x,y) Horizontal bar chart
plt.hist(data,bins=5) Histogram with 5 intervals
plt.pie(sizes,labels=names) Pie chart with labels
plt.grid(True) Shows grid lines
plt.legend() Displays legend (labels of plots)
plt.subplot(r,c,n) Multiple plots (row, col, number)
plt.show() Displays the final graph

Line Styles Meaning


linestyle='-' Solid line (default)
linestyle='--' Dashed line
linestyle=':' Dotted line
linestyle='-.' Dash-dot line

Marker Styles Meaning


marker='o' Circle marker
marker='s' Square marker
marker='^' Triangle marker
marker='*' Star marker
marker='d' Diamond marker

Color Codes Meaning


color='r' Red
color='g' Green
color='b' Blue
color='k' Black
color='y' Yellow

You might also like