theme_lt: Le Temps and Heidi.news ggplot2 themes

View source: R/dqnTheme.R

theme_ltR Documentation

Le Temps and Heidi.news ggplot2 themes

Description

Built from https://github.com/hrbrmstr/hrbrthemes

Updates [ggplot2::geom_label] and [ggplot2::geom_text] font defaults

Usage

theme_lt(
  ticks = FALSE,
  grid = "XY",
  axis = T,
  yAxisNoTitle = F,
  base_family = "Raleway",
  base_size = 15,
  plot_title_family = "Montserrat",
  plot_title_size = 21,
  plot_title_face = "bold",
  plot_title_margin = margin(b = 11),
  subtitle_family = "Raleway Light",
  subtitle_size = 15,
  subtitle_face = "plain",
  subtitle_margin = 8,
  strip_text_family = base_family,
  strip_text_size = 16,
  strip_text_face = "plain",
  caption_family = "Raleway ExtraLight",
  caption_size = 11,
  caption_face = "plain",
  caption_margin = 12,
  axis_text_size = base_size - (base_size/10),
  axis_title_family = base_family,
  axis_title_size = 15,
  axis_title_face = "bold",
  axis_title_just = "rt",
  plot_margin = margin(9, 12, 7, 3),
  grid_col = "#d6d7dd",
  axis_col = "#120707",
  axis.text.colour = "#9e9494",
  axis.title.colour = "#240f0f",
  axis.ticks.colour = "#351717"
)

theme_temps(
  ticks = FALSE,
  grid = "XY",
  axis = T,
  yAxisNoTitle = F,
  base_family = "Ratio-Medium",
  base_size = 15,
  plot_title_family = "Ratio-Bold",
  plot_title_size = 21,
  plot_title_face = "bold",
  plot_title_margin = margin(b = 11),
  subtitle_family = "Rooney-Medium",
  subtitle_size = 15,
  subtitle_face = "plain",
  subtitle_margin = 8,
  strip_text_family = base_family,
  strip_text_size = 16,
  strip_text_face = "plain",
  caption_family = "Ratio-Light",
  caption_size = 11,
  caption_face = "plain",
  caption_margin = 12,
  axis_text_size = base_size - (base_size/10),
  axis_title_family = base_family,
  axis_title_size = 15,
  axis_title_face = "bold",
  axis_title_just = "rt",
  plot_margin = margin(9, 12, 7, 3),
  grid_col = "#d6d7dd",
  axis_col = "#120707",
  axis.text.colour = "#333333",
  axis.title.colour = "#333333",
  axis.ticks.colour = "#351717",
  panel.background.colour = "#F7F7F7"
)

theme_ltmap(...)

update_geom_font_defaults(
  family = "Ratio-Medium",
  face = "plain",
  size = 3.5,
  color = "#1a1a1a"
)

Arguments

ticks

logical show axis ticks?

grid

panel grid ('TRUE', 'FALSE', or a combination of 'X', 'x', 'Y', 'y')

axis

add x or y axes? 'TRUE', 'FALSE', "'xy'"

yAxisNoTitle

a logical, should the y title, y-axis and y-ticks be removed? See this example https://rud.is/b/2016/03/16/supreme-annotations/

base_family, base_size

base font family and size

plot_title_family, plot_title_face, plot_title_size, plot_title_margin

plot title family, face, size and margin (as a 'margin' function)

subtitle_family, subtitle_face, subtitle_size

plot subtitle family, face and size

subtitle_margin

plot subtitle margin bottom (single numeric value)

strip_text_family, strip_text_face, strip_text_size

facet label font family, face and size

caption_family, caption_face, caption_size, caption_margin

plot caption family, face, size and margin

axis_text_size

font size of axis text

axis_title_family, axis_title_face, axis_title_size

axis title font family, face and size

axis_title_just

axis title font justification, one of '[blmcrt]'

plot_margin

plot margin (specify with [ggplot2::margin()])

grid_col, axis_col

grid & axis colors; default to '#666666' and '#333333'

axis.title.colour, axis.ticks.colour, axis.text.colour

a string, a colour

panel.background.colour

a string of length 1 hex string colour for the chart background

...

Arguments passed on to theme_lt

base_family,base_size

base font family and size

plot_title_family,plot_title_face,plot_title_size,plot_title_margin

plot title family, face, size and margin (as a 'margin' function)

subtitle_family,subtitle_face,subtitle_size

plot subtitle family, face and size

strip_text_family,strip_text_face,strip_text_size

facet label font family, face and size

caption_family,caption_face,caption_size,caption_margin

plot caption family, face, size and margin

axis_title_family,axis_title_face,axis_title_size

axis title font family, face and size

grid_col,axis_col

grid & axis colors; default to '#666666' and '#333333'

axis.title.colour,axis.ticks.colour,axis.text.colour

a string, a colour

family, face, size, color

font family name, face, size and color

Examples

## Not run: 
require(ggplot2)
require(dqnTheme)

qplot(1:10, 1:10, size = 10:1) + 
  xlab("axis x label") + 
  ylab ("y axis label") + 
  theme_lt() +
  labs(title = "A catchy long <span style = 'color:red;'>title</span>, that should be wrapped which is pretty awesome", 
    subtitle = "A descriptive subtitle, that is also wrapped, **pure awesomeness** too.",
    caption = "caption: Lorem ipsum dolor sit amet, consectetur adipiscing elit. A long caption that wraps too yo!")

# based on https://rud.is/b/2016/03/16/supreme-annotations/
qplot(1:10, 1:10, size = 10:1) + 
  xlab("axis x label") + 
  ylab ("y axis label") + 
  theme_lt(yAxisNoTitle = TRUE, grid = 'x') +
  labs(
    title = "A catchy title", 
    subtitle = "A descriptive subtitle", caption = "source: ofs | Le Temps") +
  annotate(geom = "label", x = 0.2, y = 10, 
    label = "super unité", hjust = 0, vjust = 0.5, 
   label.padding = unit(0.15, "lines"),
   label.size = 0)

qplot(mtcars$mpg) + 
  labs(title = "A catchy title", 
  subtitle = "a descriptive subtitle") +
theme_lt()
# seminal scatterplot
gp <- ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="Fuel efficiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 scatterplot example",
       subtitle="A plot that is only useful for demonstration purposes",
       caption="Brought to you by the letter 'g'")
gp + theme_lt()
gp + theme_lt(ticks = T)
gp + theme_lt(axis = F)
gp + theme_lt(grid = '')
gp + theme_lt(axis_col = "#d6d7dd")
gp + theme_lt( axis.text.colour = "#d6d7dd", axis_col = "#d6d7dd")

## To illustrate LT colours
avg_price <- diamonds %>%
group_by(cut, color) %>%
 summarise(price = mean(price)) %>%
 ungroup() %>%
 mutate(price_rel = price - mean(price))
sbg <- ggplot(avg_price) +
geom_col(aes(x = cut, y = price, fill = color)) +
theme_lt() +
scale_fill_manual(values = lt_pal)
sbg +
labs(title = "Super titre", subtitle = "a long useful description")

## End(Not run)
## Not run: 

# create data
time <- as.numeric(rep(seq(1,7),each=7))  # x Axis
value <- runif(49, 10, 100)               # y Axis
group <- rep(LETTERS[1:7],times=7)        # group, one shape per group
data <- data.frame(time, value, group)

ggplot(data, aes(x=time, y=value, fill=group)) + 
 geom_area() +
 theme_temps() + 
 scale_fill_manual(values = temps_pal) +
 labs(
   title = "Super long but meaningful title that will wrap which is awesome",
   subtitle = "Not less useful description of that magnificent chart",
   caption = "Source: Serious reliable stuff" 
 )

gp + theme_temps()
gp + theme_temps(ticks = T)
gp + theme_temps(axis = F)
gp + theme_temps(grid = '')

# use another palette
sbg + 
  theme_temps() + 
  scale_fill_manual(values = temps_pal)

## End(Not run)
require(ggplot2)
require(dqnTheme)
qplot(1:10, 1:10, size = 10:1) + theme_ltmap()

d-qn/tamTheme documentation built on Feb. 8, 2023, 10:46 a.m.