Download (right-click, save target as ...) this page as a jupyterlab notebook from: Lab12-HW


Laboratory 12: Matplotlib

LAST NAME, FIRST NAME

R00000000

ENGR 1330 Laboratory 12 - Homework

Line Plots


Exercise 1

The table below contains experimental observations.

Elapsed Time (s) Speed (m/s)
0 0
1.01 3
2.07 7
3.3 12
4.2 20
5.3 30
6.1 45.6

Plot the speed vs time (speed on y-axis, time on x-axis) using a line plot. From examination of the plot, estimate the speed at time t = 5.0 (eyeball estimate)


Exercise 2

Using the same series from Exercise 1, Plot the speed vs time (speed on y-axis, time on x-axis) using a scatter plot. From examination of the plot, estimate the speed at time t = 2.0 (eyeball estimate)


Exercise 3

Using the same series from Exercise 1, Plot the speed vs time (speed on y-axis, time on x-axis) using a line plot. Plot a second line based on the linear model

$$y = mx + b$$

where

$$b=0~\text{and}~m=7.6$$

Exercise 4

Using trial and error try to improve the 'fit' of the model, by adjusting values of $$m~\text{and}~b$$.


Exercise 5

Use pandas to read a dataframe from the file http://54.243.252.9/engr-1330-webroot/8-Labs/Lab12/census_18.csv. Then produce a line plot of the counts by age for the 2010 census, x-axis will be the series age, y-axis will be the census values for 2010.

Exercise 6

Using your dataframe from exercise 5, plot both the 2010 and 2014 census values by age. Plot the 2010 distribution in blue and the 2014 distribution in red.


Bar Charts


Exercise 7

Consider the data set "data" defined as

data = {'C':20, 'C++':15, 'Java':30, 'Python':35} 

which lists student count by programming language in some school.

Produce a bar chart of number of students in each language, where language is the classification, and student count is the variable.


Exercise 8

Repeat Exercise 7 but use a horizontal bar chart.