`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
Warning: Removed 798 rows containing non-finite outside the scale range
(`stat_bin()`).
Temperature Boxplots by Station
ggplot(temp, aes(x =reorder(Station, Temperature, median), y = Temperature)) +geom_boxplot(fill ="lightyellow") +ggtitle("Temperature Boxplots by Station (Ordered by Median Temperature)") +xlab("Station") +ylab("Temperature")
Warning: Removed 927 rows containing non-finite outside the scale range
(`stat_boxplot()`).
Save the Figure
ggsave("station_temp_boxplot.png")
Saving 7 x 5 in image
Warning: Removed 927 rows containing non-finite outside the scale range
(`stat_boxplot()`).
2. Part 2
temp$decdate <- temp$Year + temp$dDay3 /365
Scatterplots of Temperature and Salinity Over Time
# Temperature Changes over Timeggplot(temp, aes(x = decdate, y = Temperature)) +geom_point(color ="darkorange") +ggtitle("Temperature Changes over Time") +xlab("Decimal Date") +ylab("Temperature")
Warning: Removed 927 rows containing missing values or values outside the scale range
(`geom_point()`).
# Salinity Changes over Timeggplot(temp, aes(x = decdate, y = Salinity)) +geom_point(color ="blue") +ggtitle("Salinity Changes over Time") +xlab("Decimal Date") +ylab("Salinity")
Warning: Removed 798 rows containing missing values or values outside the scale range
(`geom_point()`).
Salinity Scatterplot Faceted by Areas
# Salinity Scatterplot Faceted by Areasggplot(temp, aes(x = decdate, y = Salinity, color = Area)) +geom_point() +facet_wrap(~ Area) +ggtitle("Salinity Time Series Faceted by Area") +xlab("Decimal Date") +ylab("Salinity")
Warning: Removed 798 rows containing missing values or values outside the scale range
(`geom_point()`).
Salinity Lineplot for Each Station by Areas
ggplot(temp, aes(x = decdate, y = Salinity, color = Station)) +geom_line(aes(group = Station)) +facet_wrap(~ Area) +ggtitle("Salinity Lineplot for Each Station by Areas") +xlab("Decimal Date") +ylab("Salinity")
Warning: Removed 4 rows containing missing values or values outside the scale range
(`geom_line()`).
Salinity Lineplot for Area ‘OS’ Only
ggplot(subset(temp, Area =="OS"), aes(x = decdate, y = Salinity, color = Station)) +geom_line(aes(group = Station)) +geom_point() +ggtitle("Salinity Lineplot for Area 'OS' Only") +xlab("Decimal Date") +ylab("Salinity")
Warning: Removed 23 rows containing missing values or values outside the scale range
(`geom_point()`).