Exercise 4: Matplotlib
Due: 5pm Sunday Feb 4, 2018
Problem 1: US age distribution?
Read the US age distribution file (US_age_distribution.csv). The file is a plain text file that looks something like this.
year,0-14 years,15-64 years,65 years+
2005,20.43,67.25,12.32
2006,20.37,67.24,12.39
2007,20.24,67.27,12.49
...
After reading the data into lists (using csv module), make the following plots.
time series of each group as a line chart
time series of each group as a bar chart
time series of these groups as a stack chart
a pie chart for the distribution at 2015
In [1]:
# Your code here
Problem 2: Population height
Base on the country_population_temperature_height.csv file,
create a scatter plot to examine if there is a relationship between population and the average height
create a scatter plot to examine if there is a relationship between the average height and the average annual temperature of each country
modify the scatter plot created in 2 to also include and present the population information in the scatter plot. (Hint: you can use different color or marker size to present population).
In [2]:
# Your code here
Problem 3: Plot hurricane tracks
Based on data in the 2016_hurricane.csv file, use basemap to plot the tracks of all tropical storms during the 2016 hurricane season in the Atlantic basin. Make sure you use the proper map projection to have minimal distortion over the region.
This document provides the detailed description about the format of the data.
use different color to indicate the intensity of the storm: TD, TS, HU. Ignore other categories
label each track by the name of the storm.
Hints:
What basemap function should you use to make the plot?
How do you use different colors based on hurricane intensity?
This csv files contains multiple tropical storm data, so there are many header lines that are different from the data lines. How do you read this data so that you won't mix up the storms.
In [3]:
# Your code here
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。