You are on page 1of 1

Question 1 (20 minutes)

Write a Python script that reads in the file “Pets.txt” that represents the number of people in
Beirut that own five types of pets.

You are required to create a 2-by-1 figure, where you plot the following:

1- On the first panel, make a pie chart that displays the percentages of people who own
the five types of pets. Show the labels (names) of the pets. Use the colors gold, blue,
red, yellow and magenta (not necessarily in any particular order). “Explode” the pie
section for the Dogs at a start angel of 125 degrees.

2- On the second panel, make a bar plot for the same data set, showing the values instead
of percentages, using the same labels and the same colors. Use an opacity (alpha) of
0.8.

This is how your graph should look like.

You might also like