Final Code

Honami Abe

# pandas, numpy, and matplotlib.pyplot are libraries (add-ons)

import pandas

import numpy as np

import matplotlib.pyplot as plt

 

# All of the X values are the values representing life expectancy at birth in Japan from 1960 to 2014

# All of the Y values are the values representing GDP per capita in US dollars in Japan from 1960 to 2014

x = [67.7,68.3,68.6,69.7,70.1,70.2,71,71.3,71.6,71.8,72,72.9,73.5,73.8,74.4,75.1,75.5,75.9,76,76.3,76.1,76.4,76.9,77,77.4,77.7,78.1,78.5,78.4,78.8,78.8,79.1,79.2,79.3,79.7,79.5,80.2,80.4,80.5,80.6,81.1,81.4,81.6,81.8,82,81.9,82.3,82.5,82.6,82.9,82.8,82.6,83.1,83.3,83.6]

y = [479,563.6,633.6,717.9,835.7,919.8,1058.5,1228.9,1450.6,1669.1,2003.6,2234.3,2917.7,3931.3,4281.4,4581.6,5111.3,6230.3,8675,8953.6,9307.8,10212.4,9428.9,10214,10786.8,11465.7,16882.3,20355.6,24592.8,24505.8,25123.6,28540.8,31013.6,35451.3,38814.9,42522.1,37422.9,34304.1,30969.7,35004.1,37299.6,32716.4,31235.6,33690.9,36441.5,35781.2,34076,34033.7,37865.6,39322.6,42935.3,46230,46701,38549.7,36152.7]

 

#This allows the color of the plots to change, r means red

#I also changed the marker from a plain circle to a diamond, represented by the D

plt.scatter(x,y, color='r', marker= 'D')

 

# These codes allow the title and the axis to be labeled.

plt.title('GDP per capita vs Life Expectancy in Japan')

plt.ylabel('GDP per capita (in US dollars)')

plt.xlabel('Life Expectancy (years)')

 

#This code allows the graph to be shown

plt.show ()

 

Design Process and Learning

Honami Abe

https://docs.google.com/document/d/1geQpF0NaNXMyjMFB5trG2AjCvmcq4ew8RwDCM_DqJcU/edit

Reason why the pl. or plt. are the way they are:

  • just a way to shorten the pylab and matplotlib.pyplot into a more convinient code.
  • The pl. and plt. is just a abbreviation, but you can change the abbreviation to anything (eg: honami, tech, quest) and it will work. AS LONG AS you stay consistent with the code that you first chose.
  • Once I type the chosen code, it will tell python to go to the function list and find the function that I've coded.