Parcourir la source

Add missing theme declaration to scales examples

tags/v0.3.0
Garrick Aden-Buie il y a 6 ans
Parent
révision
aa7413b19d
2 fichiers modifiés avec 36 ajouts et 0 suppressions
  1. +18
    -0
      R/ggplot2.R
  2. +18
    -0
      man/scale_xaringan.Rd

+ 18
- 0
R/ggplot2.R Voir le fichier

#' #'
#' if (has_ggplot2) { #' if (has_ggplot2) {
#' library(ggplot2) #' library(ggplot2)
#' # Saving the theme to a temp file because this is an example
#' path_to_css_file <- tempfile(fileext = ".css")
#'
#' # Create the xaringan theme: dark blue background with teal green accents
#' style_duo(
#' primary_color = "#002b36",
#' secondary_color = "#31b09e",
#' # Using basic fonts for this example, but the plot theme will
#' # automatically use your theme font if you use Google fonts
#' text_font_family = "sans",
#' header_font_family = "serif",
#' outfile = path_to_css_file
#' )
#'
#' # Here's some very basic example data
#' ex <- data.frame( #' ex <- data.frame(
#' name = c("Couple", "Few", "Lots", "Many"), #' name = c("Couple", "Few", "Lots", "Many"),
#' n = c(2, 3, 5, 7) #' n = c(2, 3, 5, 7)
#' ) #' )
#'
#' # Fill color scales demo
#' ggplot(ex) + #' ggplot(ex) +
#' aes(name, n, fill = n) + #' aes(name, n, fill = n) +
#' geom_col() + #' geom_col() +
#' # Fill color matches teal text #' # Fill color matches teal text
#' scale_xaringan_fill_continuous() #' scale_xaringan_fill_continuous()
#' #'
#' # Color scales demo
#' ggplot(ex) + #' ggplot(ex) +
#' aes(name, y = 1, color = name) + #' aes(name, y = 1, color = name) +
#' geom_point(size = 10) + #' geom_point(size = 10) +

+ 18
- 0
man/scale_xaringan.Rd Voir le fichier



if (has_ggplot2) { if (has_ggplot2) {
library(ggplot2) library(ggplot2)
# Saving the theme to a temp file because this is an example
path_to_css_file <- tempfile(fileext = ".css")

# Create the xaringan theme: dark blue background with teal green accents
style_duo(
primary_color = "#002b36",
secondary_color = "#31b09e",
# Using basic fonts for this example, but the plot theme will
# automatically use your theme font if you use Google fonts
text_font_family = "sans",
header_font_family = "serif",
outfile = path_to_css_file
)

# Here's some very basic example data
ex <- data.frame( ex <- data.frame(
name = c("Couple", "Few", "Lots", "Many"), name = c("Couple", "Few", "Lots", "Many"),
n = c(2, 3, 5, 7) n = c(2, 3, 5, 7)
) )

# Fill color scales demo
ggplot(ex) + ggplot(ex) +
aes(name, n, fill = n) + aes(name, n, fill = n) +
geom_col() + geom_col() +
# Fill color matches teal text # Fill color matches teal text
scale_xaringan_fill_continuous() scale_xaringan_fill_continuous()


# Color scales demo
ggplot(ex) + ggplot(ex) +
aes(name, y = 1, color = name) + aes(name, y = 1, color = name) +
geom_point(size = 10) + geom_point(size = 10) +

Chargement…
Annuler
Enregistrer