diff --git a/DESCRIPTION b/DESCRIPTION
index 3c4fa9e..a0194ee 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -11,7 +11,7 @@ Description: Provides Norads colour palette and theme for creating ggplot2 graph
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
-RoxygenNote: 7.2.3
+RoxygenNote: 7.3.1
Imports:
curl,
ggplot2,
diff --git a/Meta/vignette.rds b/Meta/vignette.rds
new file mode 100644
index 0000000..f067b0f
Binary files /dev/null and b/Meta/vignette.rds differ
diff --git a/R/ggnorad.R b/R/ggnorad.R
index 30748a0..e4ae4b1 100644
--- a/R/ggnorad.R
+++ b/R/ggnorad.R
@@ -1,10 +1,13 @@
-#' Wrapper function to load norad theme
+#' Wrapper function to load Norad theme for ggplot2.
+#' Also sets Norad's discrete and continuous color palettes as the default for the session.
#'
-#'@param style Plot style. One of "default", "biglight1", "biglight2", "bigdark".
+#'@param style Plot style. One of "default", "biglight1", "biglight2", "bigdark",
+#' "maplight", "mapdark", or "light"
+#'@param norad_colors Logical. Should Norad's color palettes be set as the default for the session? Default is TRUE.
#'@export
#'@name ggnorad
-ggnorad <- function(style = "default") {
+ggnorad <- function(style = "default", norad_colors = TRUE) {
showtext::showtext_auto()
@@ -51,4 +54,13 @@ ggnorad <- function(style = "default") {
} else if (style == "mapdark") {
ggplot2::theme_set(theme_norad_map_dark())
}
+
+ if (norad_colors == TRUE) {
+ options(ggplot2.discrete.colour = scale_color_norad)
+ options(ggplot2.discrete.fill = scale_fill_norad)
+ options(ggplot2.continuous.colour = scale_color_norad_c)
+ options(ggplot2.continuous.fill = scale_fill_norad_c)
+ options(ggplot2.binned.fill = scale_fill_norad_binned)
+ options(ggplot2.binned.colour = scale_color_norad_binned)
+ }
}
diff --git a/R/palette_functions.R b/R/palette_functions.R
index 0fcae78..43bd43d 100644
--- a/R/palette_functions.R
+++ b/R/palette_functions.R
@@ -94,22 +94,14 @@ norad_pal <- function(palette = "main", ...) {
#'
palette_gen <- function(palette = "main", direction = 1) {
-
function(n) {
-
if (n > length(norad_pal(palette)))
warning("Not enough colors in this palette!")
-
else {
-
all_colors <- norad_pal(palette)
-
all_colors <- unname(unlist(all_colors))
-
all_colors <- if (direction >= 0) all_colors else rev(all_colors)
-
color_list <- all_colors[1:n]
-
}
}
}
@@ -121,17 +113,15 @@ palette_gen <- function(palette = "main", direction = 1) {
#' @param ... Additional arguments passed to ggplot2::colorRampPalette()
#'
-palette_gen_c <- function(palette = "main", direction = 1, ...) {
-
+palette_gen_c <- function(palette = "greens", direction = 1, ...) {
+ if (!palette %in% c("greens", "browns", "purples")) {
+ stop("Only 'greens', 'browns', and 'purples' palettes are supported")
+ }
pal <- norad_pal(palette)
-
pal <- if (direction >= 0) pal else rev(pal)
-
grDevices::colorRampPalette(pal, ...)
-
}
-
#' Discrete color scale constructor for Norad colors
#'
#' @param palette Character name of palette in norad_palettes
@@ -142,8 +132,9 @@ palette_gen_c <- function(palette = "main", direction = 1, ...) {
scale_color_norad <- function(palette = "main", direction = 1, ...) {
ggplot2::discrete_scale(
- "color", "norad",
- palette_gen(palette, direction),
+ aesthetics = "color",
+ scale_name = "norad", # Deprecated in 3.5.0, but required for version <= 3.5.0, so keep for now
+ palette = palette_gen(palette, direction),
...
)
}
@@ -159,47 +150,48 @@ scale_color_norad <- function(palette = "main", direction = 1, ...) {
scale_fill_norad <- function(palette = "main", direction = 1, ...) {
ggplot2::discrete_scale(
- "fill", "norad",
- palette_gen(palette, direction),
+ aesthetics = "fill",
+ scale_name = "norad", # Deprecated in 3.5.0, but required for version <= 3.5.0, so keep for now
+ palette = palette_gen(palette, direction),
...
)
}
#' Continious color scale constructor for Norad colors
#'
-#' @param palette Character name of palette in norad_palettes
+#' @param palette Character name of palette in norad_palettes. One of "greens", "browns", or "purples"
#' @param direction Integer indicating whether the palette should be reversed
#' @param ... Additional arguments passed to ggplot2::scale_fill_gradientn()
#' @export
#'
scale_color_norad_c <- function(palette = "greens", direction = 1, ...) {
-
- pal <- palette_gen_c(palette = palette, direction = direction)
-
+ pal <- palette_gen_c(
+ palette = palette,
+ direction = direction
+ )
ggplot2::scale_color_gradientn(colors = pal(256), ...)
-
}
#' Continuous fill scale constructor for Norad colors
#'
-#' @param palette Character name of palette in norad_palettes
+#' @param palette Character name of palette in norad_palettes. One of "greens", "browns", or "purples"
#' @param direction Integer indicating whether the palette should be reversed
#' @param ... Additional arguments passed to ggplot2::scale_fill_gradientn()
#' @export
#'
scale_fill_norad_c <- function(palette = "greens", direction = 1, ...) {
-
- pal <- palette_gen_c(palette = palette, direction = direction)
-
+ pal <- palette_gen_c(
+ palette = palette,
+ direction = direction
+ )
ggplot2::scale_fill_gradientn(colors = pal(256), ...)
-
}
#' Binned fill scale constructor for Norad colors
#'
-#' @param palette Character name of palette in norad_palettes
+#' @param palette Character name of palette in norad_palettes. One of "greens", "browns", or "purples"
#' @param direction Integer indicating whether the palette should be reversed
#' @param breaks How to break down continuous data into bins. Computed automatically by default.
#' @param ... Additional arguments passed to ggplot2::scale_fill_steps()
@@ -207,16 +199,13 @@ scale_fill_norad_c <- function(palette = "greens", direction = 1, ...) {
#'
scale_fill_norad_binned <- function(palette = "greens", direction = 1, breaks = waiver(), ...) {
-
pal <- norad_pal(palette)
-
ggplot2::scale_fill_steps(low = pal[1], high = pal[2], ...)
-
}
#' Binned color scale constructor for Norad colors
#'
-#' @param palette Character name of palette in norad_palettes
+#' @param palette Character name of palette in norad_palettes. One of "greens", "browns", or "purples"
#' @param direction Integer indicating whether the palette should be reversed
#' @param breaks How to break down continuous data into bins. Computed automatically by default.
#' @param ... Additional arguments passed to ggplot2::scale_color_steps()
@@ -224,11 +213,8 @@ scale_fill_norad_binned <- function(palette = "greens", direction = 1, breaks =
#'
scale_color_norad_binned <- function(palette = "greens", direction = 1, breaks = waiver(), ...) {
-
pal <- norad_pal(palette)
-
ggplot2::scale_color_steps(low = pal[1], high = pal[2], ...)
-
}
#' @examples
diff --git a/doc/noradplot-no-subtitle.R b/doc/noradplot-no-subtitle.R
new file mode 100644
index 0000000..562a7be
--- /dev/null
+++ b/doc/noradplot-no-subtitle.R
@@ -0,0 +1,50 @@
+## ----include = FALSE----------------------------------------------------------
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>",
+ dev = "svglite"
+)
+
+## ----setup--------------------------------------------------------------------
+library(ggplot2)
+library(noradplot)
+
+ggnorad("default")
+
+
+## -----------------------------------------------------------------------------
+ggnorad("default")
+
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ caption = "Source: mpg dataset from ggplot2 package")
+
+## -----------------------------------------------------------------------------
+ggplot(mpg, aes(class)) +
+ geom_bar() +
+ scale_y_continuous(expand = expansion(mult = c(0, 0.05))) +
+ labs(title = "Number of vehicles",
+ caption = "Source: mpg dataset from ggplot2 package")
+
+## ----message=FALSE------------------------------------------------------------
+library(dplyr)
+
+df <- tibble("temp" = as.numeric(nhtemp), "time" = as.numeric(time(nhtemp)))
+
+df |>
+ ggplot(aes(time, temp)) +
+ geom_line() +
+ scale_color_norad() +
+ labs(title = "New Haven temperature",
+ caption = "Source: nhtemp dataset from datasets package")
+
+## -----------------------------------------------------------------------------
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ caption = "Source: mpg dataset from ggplot2 package") +
+ facet_wrap(~class)
+
diff --git a/doc/noradplot-no-subtitle.Rmd b/doc/noradplot-no-subtitle.Rmd
new file mode 100644
index 0000000..5a76bdf
--- /dev/null
+++ b/doc/noradplot-no-subtitle.Rmd
@@ -0,0 +1,79 @@
+---
+title: "noradplot"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{noradplot}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>",
+ dev = "svglite"
+)
+```
+
+```{r setup}
+library(ggplot2)
+library(noradplot)
+
+ggnorad("default")
+
+```
+
+## Scatter plot
+```{r}
+#| fig.width: 6
+#| fig.height: 4
+ggnorad("default")
+
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ caption = "Source: mpg dataset from ggplot2 package")
+```
+
+## Bar chart
+```{r}
+#| fig.width: 6
+#| fig.height: 4
+
+ggplot(mpg, aes(class)) +
+ geom_bar() +
+ scale_y_continuous(expand = expansion(mult = c(0, 0.05))) +
+ labs(title = "Number of vehicles",
+ caption = "Source: mpg dataset from ggplot2 package")
+```
+
+## Line chart
+```{r, message=FALSE}
+#| fig.width: 6
+#| fig.height: 4
+
+library(dplyr)
+
+df <- tibble("temp" = as.numeric(nhtemp), "time" = as.numeric(time(nhtemp)))
+
+df |>
+ ggplot(aes(time, temp)) +
+ geom_line() +
+ scale_color_norad() +
+ labs(title = "New Haven temperature",
+ caption = "Source: nhtemp dataset from datasets package")
+```
+
+## Faceted plot
+```{r}
+#| fig.width: 6
+#| fig.height: 5
+
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ caption = "Source: mpg dataset from ggplot2 package") +
+ facet_wrap(~class)
+```
diff --git a/doc/noradplot-no-subtitle.html b/doc/noradplot-no-subtitle.html
new file mode 100644
index 0000000..a45d3c8
--- /dev/null
+++ b/doc/noradplot-no-subtitle.html
@@ -0,0 +1,1869 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+noradplot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+noradplot
+
+
+
+library (ggplot2)
+library (noradplot)
+
+ggnorad ("default" )
+
+
Scatter plot
+
ggnorad ("default" )
+
+ggplot (mpg, aes (displ, hwy, color = class)) +
+ geom_point () +
+ scale_color_norad () +
+ labs (title = "Displacement and highway mileage" ,
+ caption = "Source: mpg dataset from ggplot2 package" )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Bar chart
+
ggplot (mpg, aes (class)) +
+ geom_bar () +
+ scale_y_continuous (expand = expansion (mult = c (0 , 0.05 ))) +
+ labs (title = "Number of vehicles" ,
+ caption = "Source: mpg dataset from ggplot2 package" )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Line chart
+
library (dplyr)
+
+ df <- tibble ("temp" = as.numeric (nhtemp), "time" = as.numeric (time (nhtemp)))
+
+ df |>
+ ggplot (aes (time, temp)) +
+ geom_line () +
+ scale_color_norad () +
+ labs (title = "New Haven temperature" ,
+ caption = "Source: nhtemp dataset from datasets package" )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Faceted plot
+
ggplot (mpg, aes (displ, hwy, color = class)) +
+ geom_point () +
+ scale_color_norad () +
+ labs (title = "Displacement and highway mileage" ,
+ caption = "Source: mpg dataset from ggplot2 package" ) +
+ facet_wrap (~ class)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/noradplot.R b/doc/noradplot.R
new file mode 100644
index 0000000..9b9da8e
--- /dev/null
+++ b/doc/noradplot.R
@@ -0,0 +1,54 @@
+## ----include = FALSE----------------------------------------------------------
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>",
+ dev = "svglite"
+)
+
+## ----setup--------------------------------------------------------------------
+library(ggplot2)
+library(noradplot)
+
+ggnorad("default")
+
+
+## -----------------------------------------------------------------------------
+ggnorad("default")
+
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ subtitle = "By vehicle class",
+ caption = "Source: mpg dataset from ggplot2 package")
+
+## -----------------------------------------------------------------------------
+ggplot(mpg, aes(class)) +
+ geom_bar() +
+ scale_y_continuous(expand = expansion(mult = c(0, 0.05))) +
+ labs(title = "Number of vehicles",
+ subtitle = "By vehicle class",
+ caption = "Source: mpg dataset from ggplot2 package")
+
+## ----message=FALSE------------------------------------------------------------
+library(dplyr)
+
+df <- tibble("temp" = as.numeric(nhtemp), "time" = as.numeric(time(nhtemp)))
+
+df |>
+ ggplot(aes(time, temp)) +
+ geom_line() +
+ scale_color_norad() +
+ labs(title = "New Haven temperature",
+ subtitle = "Data for 1912-1971",
+ caption = "Source: nhtemp dataset from datasets package")
+
+## -----------------------------------------------------------------------------
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ subtitle = "By vehicle class",
+ caption = "Source: mpg dataset from ggplot2 package") +
+ facet_wrap(~class)
+
diff --git a/doc/noradplot.Rmd b/doc/noradplot.Rmd
new file mode 100644
index 0000000..ac77f48
--- /dev/null
+++ b/doc/noradplot.Rmd
@@ -0,0 +1,83 @@
+---
+title: "noradplot"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{noradplot}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>",
+ dev = "svglite"
+)
+```
+
+```{r setup}
+library(ggplot2)
+library(noradplot)
+
+ggnorad("default")
+
+```
+
+## Scatter plot
+```{r}
+#| fig.width: 6
+#| fig.height: 4
+ggnorad("default")
+
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ subtitle = "By vehicle class",
+ caption = "Source: mpg dataset from ggplot2 package")
+```
+
+## Bar chart
+```{r}
+#| fig.width: 6
+#| fig.height: 4
+
+ggplot(mpg, aes(class)) +
+ geom_bar() +
+ scale_y_continuous(expand = expansion(mult = c(0, 0.05))) +
+ labs(title = "Number of vehicles",
+ subtitle = "By vehicle class",
+ caption = "Source: mpg dataset from ggplot2 package")
+```
+
+## Line chart
+```{r, message=FALSE}
+#| fig.width: 6
+#| fig.height: 4
+
+library(dplyr)
+
+df <- tibble("temp" = as.numeric(nhtemp), "time" = as.numeric(time(nhtemp)))
+
+df |>
+ ggplot(aes(time, temp)) +
+ geom_line() +
+ scale_color_norad() +
+ labs(title = "New Haven temperature",
+ subtitle = "Data for 1912-1971",
+ caption = "Source: nhtemp dataset from datasets package")
+```
+
+## Faceted plot
+```{r}
+#| fig.width: 6
+#| fig.height: 5
+
+ggplot(mpg, aes(displ, hwy, color = class)) +
+ geom_point() +
+ scale_color_norad() +
+ labs(title = "Displacement and highway mileage",
+ subtitle = "By vehicle class",
+ caption = "Source: mpg dataset from ggplot2 package") +
+ facet_wrap(~class)
+```
diff --git a/doc/noradplot.html b/doc/noradplot.html
new file mode 100644
index 0000000..51ffb46
--- /dev/null
+++ b/doc/noradplot.html
@@ -0,0 +1,1931 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+noradplot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+noradplot
+
+
+
+library (ggplot2)
+library (noradplot)
+
+ggnorad ("default" )
+
+
Scatter plot
+
ggnorad ("default" )
+
+ggplot (mpg, aes (displ, hwy, color = class)) +
+ geom_point () +
+ scale_color_norad () +
+ labs (title = "Displacement and highway mileage" ,
+ subtitle = "By vehicle class" ,
+ caption = "Source: mpg dataset from ggplot2 package" )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Bar chart
+
ggplot (mpg, aes (class)) +
+ geom_bar () +
+ scale_y_continuous (expand = expansion (mult = c (0 , 0.05 ))) +
+ labs (title = "Number of vehicles" ,
+ subtitle = "By vehicle class" ,
+ caption = "Source: mpg dataset from ggplot2 package" )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Line chart
+
library (dplyr)
+
+ df <- tibble ("temp" = as.numeric (nhtemp), "time" = as.numeric (time (nhtemp)))
+
+ df |>
+ ggplot (aes (time, temp)) +
+ geom_line () +
+ scale_color_norad () +
+ labs (title = "New Haven temperature" ,
+ subtitle = "Data for 1912-1971" ,
+ caption = "Source: nhtemp dataset from datasets package" )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Faceted plot
+
ggplot (mpg, aes (displ, hwy, color = class)) +
+ geom_point () +
+ scale_color_norad () +
+ labs (title = "Displacement and highway mileage" ,
+ subtitle = "By vehicle class" ,
+ caption = "Source: mpg dataset from ggplot2 package" ) +
+ facet_wrap (~ class)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/man/ggnorad.Rd b/man/ggnorad.Rd
index e8dcbd2..7ba80f5 100644
--- a/man/ggnorad.Rd
+++ b/man/ggnorad.Rd
@@ -2,13 +2,18 @@
% Please edit documentation in R/ggnorad.R
\name{ggnorad}
\alias{ggnorad}
-\title{Wrapper function to load norad theme}
+\title{Wrapper function to load Norad theme for ggplot2.
+Also sets Norad's discrete and continuous color palettes as the default for the session.}
\usage{
-ggnorad(style = "default")
+ggnorad(style = "default", norad_colors = TRUE)
}
\arguments{
-\item{style}{Plot style. One of "default", "biglight1", "biglight2", "bigdark".}
+\item{style}{Plot style. One of "default", "biglight1", "biglight2", "bigdark",
+"maplight", "mapdark", or "light"}
+
+\item{norad_colors}{Logical. Should Norad's color palettes be set as the default for the session? Default is TRUE.}
}
\description{
-Wrapper function to load norad theme
+Wrapper function to load Norad theme for ggplot2.
+Also sets Norad's discrete and continuous color palettes as the default for the session.
}
diff --git a/man/palette_gen_c.Rd b/man/palette_gen_c.Rd
index 2a19bb2..588cf4f 100644
--- a/man/palette_gen_c.Rd
+++ b/man/palette_gen_c.Rd
@@ -4,7 +4,7 @@
\alias{palette_gen_c}
\title{Helper function for continuous color scales}
\usage{
-palette_gen_c(palette = "main", direction = 1, ...)
+palette_gen_c(palette = "greens", direction = 1, ...)
}
\arguments{
\item{palette}{Character name of palette in norad_palettes}
diff --git a/man/scale_color_norad_binned.Rd b/man/scale_color_norad_binned.Rd
index 0bfac2f..cb1d1d0 100644
--- a/man/scale_color_norad_binned.Rd
+++ b/man/scale_color_norad_binned.Rd
@@ -12,7 +12,7 @@ scale_color_norad_binned(
)
}
\arguments{
-\item{palette}{Character name of palette in norad_palettes}
+\item{palette}{Character name of palette in norad_palettes. One of "greens", "browns", or "purples"}
\item{direction}{Integer indicating whether the palette should be reversed}
diff --git a/man/scale_color_norad_c.Rd b/man/scale_color_norad_c.Rd
index 653342b..f9cf269 100644
--- a/man/scale_color_norad_c.Rd
+++ b/man/scale_color_norad_c.Rd
@@ -7,7 +7,7 @@
scale_color_norad_c(palette = "greens", direction = 1, ...)
}
\arguments{
-\item{palette}{Character name of palette in norad_palettes}
+\item{palette}{Character name of palette in norad_palettes. One of "greens", "browns", or "purples"}
\item{direction}{Integer indicating whether the palette should be reversed}
diff --git a/man/scale_fill_norad_binned.Rd b/man/scale_fill_norad_binned.Rd
index f3c3f29..c8020e5 100644
--- a/man/scale_fill_norad_binned.Rd
+++ b/man/scale_fill_norad_binned.Rd
@@ -12,7 +12,7 @@ scale_fill_norad_binned(
)
}
\arguments{
-\item{palette}{Character name of palette in norad_palettes}
+\item{palette}{Character name of palette in norad_palettes. One of "greens", "browns", or "purples"}
\item{direction}{Integer indicating whether the palette should be reversed}
diff --git a/man/scale_fill_norad_c.Rd b/man/scale_fill_norad_c.Rd
index 9a74bf3..ba416d4 100644
--- a/man/scale_fill_norad_c.Rd
+++ b/man/scale_fill_norad_c.Rd
@@ -7,7 +7,7 @@
scale_fill_norad_c(palette = "greens", direction = 1, ...)
}
\arguments{
-\item{palette}{Character name of palette in norad_palettes}
+\item{palette}{Character name of palette in norad_palettes. One of "greens", "browns", or "purples"}
\item{direction}{Integer indicating whether the palette should be reversed}