From 0ffd02335c76349f0f89219fff39d43c62da4992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=B0=B8=E6=A5=A0=7CMorgan=7CL=C3=A9on?= Date: Wed, 18 Oct 2017 09:52:27 +0800 Subject: [PATCH] Update ufo_sightings.R --- 01-Introduction/ufo_sightings.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/01-Introduction/ufo_sightings.R b/01-Introduction/ufo_sightings.R index c240b47..4f2be4b 100644 --- a/01-Introduction/ufo_sightings.R +++ b/01-Introduction/ufo_sightings.R @@ -118,7 +118,7 @@ head(ufo.us) # We can do this by creating a histogram of frequencies for UFO sightings over time quick.hist <- ggplot(ufo.us, aes(x = DateOccurred)) + geom_histogram() + - scale_x_date(breaks = "50 years") + scale_x_date(date_breaks = "50 years",date_labels = "%Y") ggsave(plot = quick.hist, filename = file.path("images", "quick_hist.pdf"), @@ -134,7 +134,7 @@ new.hist <- ggplot(ufo.us, aes(x = DateOccurred)) + geom_histogram(aes(fill='white', color='red')) + scale_fill_manual(values=c('white'='white'), guide="none") + scale_color_manual(values=c('red'='red'), guide="none") + - scale_x_date(breaks = "50 years") + scale_x_date(date_breaks = "50 years",date_labels = "%Y") ggsave(plot = new.hist, filename = file.path("images", "new_hist.pdf"), @@ -204,7 +204,7 @@ state.plot <- ggplot(all.sightings, aes(x = YearMonth,y = Sightings)) + facet_wrap(~State, nrow = 10, ncol = 5) + theme_bw() + scale_color_manual(values = c("darkblue" = "darkblue"), guide = "none") + - scale_x_date(breaks = "5 years", labels = date_format('%Y')) + + scale_x_date(date_breaks = "5 years", date_labels = "%Y") + xlab("Years") + ylab("Number of Sightings") + ggtitle("Number of UFO sightings by Month-Year and U.S. State (1990-2010)") @@ -229,7 +229,7 @@ state.plot.norm <- ggplot(all.sightings, aes(x = YearMonth,y = Sightings.Norm)) facet_wrap(~State, nrow = 10, ncol = 5) + theme_bw() + scale_color_manual(values = c("darkblue" = "darkblue"), guide = "none") + - scale_x_date(breaks = "5 years", labels = date_format('%Y')) + + scale_x_date(date_breaks = "5 years", date_labels = "%Y") + xlab("Years") + ylab("Per Capita Number of Sightings (2000 Census)") + ggtitle("Number of UFO sightings by Month-Year and U.S. State (1990-2010)")