Skip to content
Snippets Groups Projects
Commit db3a4fd8 authored by Ben Anderson's avatar Ben Anderson
Browse files

added palettes & tested colours; re-run

parent a780a28a
No related branches found
No related tags found
No related merge requests found
...@@ -303,6 +303,14 @@ demandCopyright <- paste0(projLoc,"/demandCopyright.Rmd") ...@@ -303,6 +303,14 @@ demandCopyright <- paste0(projLoc,"/demandCopyright.Rmd")
# Parameters ---- # Parameters ----
# http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/#a-colorblind-friendly-palette
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
# see also
# https://www.r-bloggers.com/palettes-in-r/
# local MTUS (UK sample, processed 1974/5 - 2014/15) # local MTUS (UK sample, processed 1974/5 - 2014/15)
if(userName == "ben" | userName == "ba1e12"){ if(userName == "ben" | userName == "ba1e12"){
# assume laptop or RStudio Server # assume laptop or RStudio Server
...@@ -1022,7 +1030,8 @@ Fig \ref(fig:allYearsStackedByWeekday) shows all DEMAND activities stacked by da ...@@ -1022,7 +1030,8 @@ Fig \ref(fig:allYearsStackedByWeekday) shows all DEMAND activities stacked by da
aggHhDemandActsWtDT <- makeHmsTime(aggHhDemandActsWtDT) # add hms time aggHhDemandActsWtDT <- makeHmsTime(aggHhDemandActsWtDT) # add hms time
myCaption <- "Synthetic MTUS 1974 - 2014, UK sample (%, weighted)" myCaption <- "Synthetic MTUS 1974 - 2014, UK sample (%, weighted)"
ba_createStackedPlot(aggHhDemandActsWtDT, yVar = "pcAnyHHMainWt", fillVar = "actLabel", yLabel = "% halfhours (main act)", facetVars = "ba_survey ~ r_wday") ba_createStackedPlot(aggHhDemandActsWtDT, yVar = "pcAnyHHMainWt", fillVar = "actLabel", yLabel = "% halfhours (main act)", facetVars = "ba_survey ~ r_wday") +
scale_fill_brewer(palette="Paired")
``` ```
Fig \ref(fig:allYearsStackedByWeekday) shows all DEMAND activities stacked by day of the week uses line chart to show all acts in vs out of home. Fig 3 in paper. Fig \ref(fig:allYearsStackedByWeekday) shows all DEMAND activities stacked by day of the week uses line chart to show all acts in vs out of home. Fig 3 in paper.
...@@ -1074,7 +1083,8 @@ myTextSize <- 3 ...@@ -1074,7 +1083,8 @@ myTextSize <- 3
# scale_fill_hue() # scale_fill_hue()
ba_createLinePlot(plotDT, yVar = "pcAnyHHMainWt", fillVar = "actLabel", yLabel = "% halfhours (main act)", facetVars = "ba_survey ~ inHome") + ba_createLinePlot(plotDT, yVar = "pcAnyHHMainWt", fillVar = "actLabel", yLabel = "% halfhours (main act)", facetVars = "ba_survey ~ inHome") +
scale_fill_hue() scale_fill_hue() +
scale_fill_brewer(palette="Paired")
ggsave("allYearsLinePlot_R2Fig3.png", height = 8) ggsave("allYearsLinePlot_R2Fig3.png", height = 8)
``` ```
...@@ -2062,7 +2072,9 @@ Plot change in GW against change in TU. Each point is a half-hour. ...@@ -2062,7 +2072,9 @@ Plot change in GW against change in TU. Each point is a half-hour.
```{r plotAbsoluteGWDeltaTU, fig.cap="Comparing absolute GW change"} ```{r plotAbsoluteGWDeltaTU, fig.cap="Comparing absolute GW change"}
addPlotStuff <- function(p){ addPlotStuff <- function(p){
p <- p + p <- p +
geom_hline(yintercept = 0, colour = "grey") + geom_hline(yintercept = 0, colour = "#999999") + # grey http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/#a-colorblind-friendly-palette
geom_vline(xintercept = 0, colour = "#999999") +
#scale_colour_manual(values=cbbPalette) +
geom_point(aes(colour = peakPeriod)) + geom_point(aes(colour = peakPeriod)) +
theme(legend.position = "bottom") + theme(legend.position = "bottom") +
theme(legend.title = element_blank()) + theme(legend.title = element_blank()) +
...@@ -2080,11 +2092,16 @@ addPlotStuff(myPlot) + geom_smooth(colour = "black" , se=TRUE) ...@@ -2080,11 +2092,16 @@ addPlotStuff(myPlot) + geom_smooth(colour = "black" , se=TRUE)
Repeat but for relative GW (Figure \@ref(fig:plotRelativeGWDeltaTU)). Repeat but for relative GW (Figure \@ref(fig:plotRelativeGWDeltaTU)).
```{r plotRelativeGWDeltaTU, fig.cap="Comparing relative GW change"} ```{r plotRelativeGWDeltaTU, fig.cap="Comparing relative GW change"}
# https://stackoverflow.com/questions/38722202/how-do-i-change-the-number-of-decimal-places-on-axis-labels-in-ggplot2
scaleFUN <- function(x) sprintf("%.2f", x)
myPlot <- ggplot2::ggplot(compareJunDT, aes(x = meanNormDiffGW, y = deltaMain)) + myPlot <- ggplot2::ggplot(compareJunDT, aes(x = meanNormDiffGW, y = deltaMain)) +
geom_vline(xintercept = 0, colour = "grey") +
labs(x = "Mean change in normalised GW", labs(x = "Mean change in normalised GW",
y = "% point change in recorded half hours") y = "% point change in recorded half hours")
addPlotStuff(myPlot) + geom_smooth(colour = "black" , se=TRUE) addPlotStuff(myPlot) +
geom_smooth(colour = "black" , se=TRUE) +
scale_y_continuous(labels=scaleFUN) +
scale_x_continuous(labels=scaleFUN)
ggsave("plotRelativeGWDeltaTU_R2Fig6.png", height = 6) ggsave("plotRelativeGWDeltaTU_R2Fig6.png", height = 6)
``` ```
......
Theme-1/changeOverTime/paper/plotRelativeGWDeltaTU_R2Fig6.png

305 KiB | W: | H:

Theme-1/changeOverTime/paper/plotRelativeGWDeltaTU_R2Fig6.png

305 KiB | W: | H:

Theme-1/changeOverTime/paper/plotRelativeGWDeltaTU_R2Fig6.png
Theme-1/changeOverTime/paper/plotRelativeGWDeltaTU_R2Fig6.png
Theme-1/changeOverTime/paper/plotRelativeGWDeltaTU_R2Fig6.png
Theme-1/changeOverTime/paper/plotRelativeGWDeltaTU_R2Fig6.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment