[Solved] COMP1007 Assignment5-fundamental operations of Matplotlib

$25

File Name: COMP1007_Assignment5-fundamental_operations_of_Matplotlib.zip
File Size: 536.94 KB

SKU: [Solved] COMP1007 Assignment5-fundamental operations of Matplotlib Category: Tag:
5/5 - (1 vote)

This assignment helps you review the fundamental operations of Matplotlib (covered by our labs) and self-learn some new features (not covered by our labs). Please store all your solutions in a single Python file. Use a separate cell for each question.

  1. Write a Python program that generates the following figure with 4 subplots, each with a differentmarker style.

Hint: when you call the scatter() function, set the marker parameter to +, x, 4, and 5 respectively, for the four different marker style. E.g., axes.scatter(x, y, marker=+).

Marker reference: https://matplotlib.org/api/markers_api.html#module-matplotlib.markers

  1. Assume a dictionary books = {Tom:10, Dick:11, Harry:9, Slim:7, Jim:12} stores the number of books of five students. Write a Python program that generates the following figure.

Hint:

  • to get the list of dictionary values, you can use list(books.values());
  • to get the list of dictionary keys (as the y-axis labels), you can use list(books);
  • to set the y-axis ticks and labels, use function set_yticks() and set_yticklabels(). You can learn from the following online example to set the y-axis labels correctly:

https://matplotlib.org/gallery/lines_bars_and_markers/barh.html

  1. Study the example at https://matplotlib.org/gallery/lines_bars_and_markers/simple_plot.html. Then write a Python program that generates the following figure with 2 subplots.

Hint: you may need to use the tight_layout() function to set a tight layout.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP1007 Assignment5-fundamental operations of Matplotlib
$25