ggplot homework

Author

Biol 607

Intro

A little while back, Dave Curran using some of the code I’d posted from a previous 607 lab made a wonderful animation of change in arctic sea ice.

He used data from

ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/north/daily/data/NH_seaice_extent_final_v2.csv ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/north/daily/data/NH_seaice_extent_nrt_v2.csv

I’m providing you with a cleaned form of his data (his code is here) for you to work with in a few plots. The data file is called NH_seaice_extent_monthly_1978_2016.csv - but don’t worry, I’m giving you code to load it.

1. Start

Some setup. Run the code below. Show that it worked by showing the basic properties of the data. To impress yourself, look up the packages and functions used and explain what is going on here. But, that’s an IYKYK - not needed!

# libraries - if they don't load
# install.packages("tidyverse")
library(dplyr)
library(readr)
library(ggplot2)
library(forcats)

theme_set(theme_bw(base_size=12))

ice <- read_csv("http://biol607.github.io/homework/data/NH_seaice_extent_monthly_1978_2016.csv") %>%
  mutate(Month_Name = factor(Month_Name),
         Month_Name = fct_reorder(Month_Name, Month))

2. Boxplots

Make a boxplot showing the variability in sea ice extent every month. IYKYK make it fancy.

3. Ridgelines

Use ggridges to do the same thing. What do you learn that is different than the boxplot?

4. Making Groups from the Continuous

One thing that’s really cool about faceting is that you can use cut_*() functions on continuous variables to make facets by groups of continuous variables. To see what I mean, try cut_interval(1:10, n = 5) See how it makes five bins of even width? We use cut_interval() or other cut functions with faceting like so facet_wrap(vars(cut_interval(some_variable))).

With the original data, plot sea ice by year, with different lines (oh! What geom will you need for that?) for different months. Then, use facet_wrap and cut_interval(Month, n=4) to split the plot into seasons.

5. Use That Color!

Last, make a line plot of sea ice by month with different lines as different years. Gussy it up with colors by year, a different theme, critical values, and whatever other annotations, changes to axes, etc., you think best show the story of this data. For ideas, see the lab, and look at various palettes around. Extra credit for using colorfindr to make a palette.


Impress Yourself with Knowledge You Conquered 1. gganimate

Make it animated with gganimate. Just like above. See https://gganimate.com/ to learn the package!

Impress Yourself with Knowledge You Conquered 2. Something new

Use the data and make something wholly new and awesome. Even extra extra credit for something amazing animated.

Impress Yourself with Knowledge You Conquered 3. #TidyTuesday

Participate in this week or last week’s (or this week’s) tidy tuesday (and see that link to learn waht it is). See here for data and schedule. Not only include what you do and your code here, but also include a link to where you tweet our your entry with a link to the code and the #tidytuesday hashtag.


Meta 1.

We are now generating figures and imagery. It’s something that blends creativity, abstract thinking, and quantiative abilities. How confident were you in thinking about making figures before this week versus after grappling with ggplot and the grammer of graphics philosophy?

Meta 2.

What’s your favorite think about data visualization?

Meta 3.

How much time did this take you, roughly? I’m trying to keep track that these assignments aren’t killer, more than anything.

Meta 4.

Please give yourself a weak/sufficient/strong assessment on this assigment. Feel free to comment on why.