Philip Bulsink
2017-03-18
Following up on my first assignment, this presentation will show a plotly plot with how many people live in each NHL city.
The NHL Cities are:
cities<-c('Anaheim', 'Boston', 'Buffalo', 'Calgary', 'Chicago', 'Columbus', 'Dallas', 'Denver', 'Detroit', 'Edmonton', 'Glendale, Arizona', 'Los Angeles', 'Montreal', 'Nashville', 'New York (City)', 'Newark, New Jersey', 'Ottawa', 'Philadelphia', 'Pittsburgh', 'Raleigh', 'San Jose', 'St. Louis', 'St. Paul, Minnisota', 'Sunrise, Florida', 'Tampa Bay ', 'Toronto', 'New York (Island)', 'Vancouver', 'Washington', 'Winnipeg')
The populations of the city proper and metro areas are:
cityPop<-c(345012, 645966, 258959, 1149552, 2718782, 822533, 1257676, 649495, 688701, 877926, 234632, 3884307, 1649519, 634464, 8405837, 278427, 883391, 1553165, 305841, 431746, 998537, 318413, 294873, 90116, 352957, 2791140, 24759, 603502, 646449, 698696)
metroPop<-c(3145515, 4732161, 1136360, 1406721, 9554598, 1994536, 6954330, 2754258, 4296611, 1328290, 4039182, 13262220, 4027121, 1792649, 20092833, 2508124, 1318122, 6051170, 2355968, 1242974, 1952872, 2806207, 3495176, 1748066, 2915582, 6055724, 2861595, 2470289, 6033737, 782640)
The cities and population are put together for a plotly plot:
citySize<-data.frame(City=cities, Population=cityPop, Metro=metroPop)
library(plotly)
p<-plot_ly(data=citySize, x= ~City, y = ~Population, type = 'bar' ,name = 'City Pop.') %>% add_trace(y = ~Metro, name = 'Metro Pop.') %>% layout(title = 'NHL City & Metro Region Populations', xaxis = list(title = "", tickangle = -45), yaxis = list(title = 'Population'), barmode = 'group')