author: angelayuan
date: Friday, Jul 31, 2015
The goal of this assignment is to get some experience with handling and deciding how to visualize some data and to get a feel for the various aspects of the visualization. This assignment will also help to analyze other visualizations and assess their effectiveness.
Data comes from https://d396qusza40orc.cloudfront.net/datavisualization/programming_assignment_1/Programming%20Assignment%201%20Data%20New.zip
It contains the following information: (1) temperature variation in each month/season across years (from 1880 to 2015); and (2) temperature variation across spaces (e.g. north hemisphere, south hemisphere) from 1880 to 2014.
library(dygraphs)
library(xts)
data1 <- read.csv("ExcelFormattedGISTEMPDataCSV.csv", stringsAsFactors = FALSE)
data2 <- read.csv("ExcelFormattedGISTEMPData2CSV.csv", stringsAsFactors = FALSE)
In the following graphs, you can see how temperature varied across years in each season, and how temperature varied across years and locations. You can put your mouse on the graph to interact with it; and you can also check a shorter period of time by adjusting the scale just above the label “Year”.
s1 <- as.xts(ts(data1$DJF, frequency=1, start=data1$Year[1]))
s2 <- as.xts(ts(data1$MAM, frequency=1, start=data1$Year[1]))
s3 <- as.xts(ts(data1$JJA, frequency=1, start=data1$Year[1]))
s4 <- as.xts(ts(data1$SON, frequency=1, start=data1$Year[1]))
seasons <- cbind(DJF=s1, MAM=s2, JJA=s3, SON=s4)
dygraph(seasons, main = "Temperature variation in each season across years",
xlab = "Year", ylab = "Deviation") %>%
dyHighlight(highlightCircleSize = 4,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = TRUE) %>%
dyOptions(colors = RColorBrewer::brewer.pal(4, "Set1"))%>%
dyRangeSelector()
This graph visualizes the GISTEMP data for each season (i.e., Dec-Feb, Mar-May, Jun-Aug, and Sep-Nov) through all the given years (i.e. from 1880 to 2015). The Y Axis is the deviation from the 1951-1980 mean in 0.01 degrees. The X axis is Year. The Red line describes how temperature varies for the Dec-Feb season, the Blue line for the MAr-May season, the Green for the Jun-Aug season, and the Purple for the Sep-Nov season.
The resulting graph shows that all four seasons’ tempreture increase over the years. To check the data of each season in each year, please put your mouse on that line.
Glob <- as.xts(ts(data2$Glob, frequency=1, start=data2$Year[1]))
NHem <- as.xts(ts(data2$NHem, frequency=1, start=data2$Year[1]))
SHem <- as.xts(ts(data2$SHem, frequency=1, start=data2$Year[1]))
locations <- cbind(Global=Glob, NHem=NHem, SHem=SHem)
dygraph(locations, main = "Temperature variation across years and locations",
xlab = "Year", ylab = "Deviation") %>%
dyHighlight(highlightCircleSize = 4,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = TRUE) %>%
dyOptions(colors = RColorBrewer::brewer.pal(3, "Set1"))%>%
dyRangeSelector()
This graph visualizes the GISTEMP data for the Globe and the North and South Hemispheres through all the given years (i.e. from 1880 to 2014). The Y Axis is the deviation from the 1951-1980 mean in 0.01 degrees. The X axis is Year. The Red line describes how temperature varies for the Globe, the Blue line for the North Hemisphere, and the Green for the South Hemisphere.
The resulting graph shows that (1) global tempreture as well as North and South Hemisphere’s tempreture all increase over the years; and (2) temperature in North Hemisphere becomes higher than South Hemisphere in recent years (i.e., from 2000 to 2014).