0% found this document useful (0 votes)
7 views3 pages

Matplotlib Practice Questions - RJ

The document contains a series of practice questions for using Matplotlib, covering basic plotting, markers, lines, colors, labels, titles, grids, subplots, scatter plots, bar charts, histograms, and pie charts. It includes tasks such as plotting points, modifying plots, adding labels and titles, and creating various types of charts. Additionally, it presents challenge questions that involve creating dashboards and comparing datasets.

Uploaded by

Anne-Sophie
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Matplotlib Practice Questions - RJ

The document contains a series of practice questions for using Matplotlib, covering basic plotting, markers, lines, colors, labels, titles, grids, subplots, scatter plots, bar charts, histograms, and pie charts. It includes tasks such as plotting points, modifying plots, adding labels and titles, and creating various types of charts. Additionally, it presents challenge questions that involve creating dashboards and comparing datasets.

Uploaded by

Anne-Sophie
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Matplotlib Practice Questions

Basic Plotting

1. Write code to plot the points:


o x = [0, 1, 2, 3]
o y = [10, 20, 25, 30]
2. Modify the above plot to:
o Show only markers (no line)
o Use circle markers
3. Plot multiple points:
o (1,3), (2,8), (6,1), (8,10)

Markers, Lines, Colors

4. What does the format string 'o:r' represent?


5. Write a plot using:
o Square markers
o Dashed line
o Any color
6. How do you change:
 Marker size
 Line width

Labels, Titles, Grid

7. Add labels “Time” (x-axis) and “Speed” (y-axis) to a plot.


8. Add a title “Car Speed Analysis”.
9. How do you:
 Add grid lines?
 Change title position?

Subplots

10. What is the purpose of subplot()?


11. Create:
 2 plots in 1 row
 1st: line plot
 2nd: scatter plot

Scatter Plots

12. What is a scatter plot used for?


Matplotlib Practice Questions

13. Create a scatter plot using:


 x = [1,2,3,4,5]
 y = [5,7,8,2,4]
14. Modify the scatter plot to:
 Use different sizes
 Add transparency

Bar Charts

15. What is the difference between bar() and barh()?


16. Create a bar chart:
 Categories: A, B, C, D
 Values: 5, 7, 3, 8
17. Create a horizontal bar chart and adjust bar thickness.

Histograms

18. What is a histogram?


19. Generate 200 random numbers using:
 Mean = 170
 Standard deviation = 10
20. Plot a histogram and:
 Change number of bins

Pie Charts

21. What is a pie chart used for?


22. Create a pie chart:
 Values: [40, 30, 20, 10]
23. Modify it to:
 Add labels
 Explode one slice
 Add legend

Challenge Questions

24. Create a dashboard using subplots that includes:


Matplotlib Practice Questions

 Line plot
 Scatter plot
 Bar chart
 Pie chart
25. Given a dataset of student marks:
 Plot a histogram
 Plot a bar chart of grades
 Add titles and labels
26. Compare two datasets using:
 Two scatter plots on same graph

You might also like