Package 'customthemes'

Title: custom theming for ggplot, for personal use
Description: Collection of (ggplot) theming options for personal use.
Authors: Carlos Yanez Santibanez [aut, cre]
Maintainer: Carlos Yanez Santibanez <[email protected]>
License: CC BY 4.0
Version: 0.0.1.0002
Built: 2024-09-19 04:13:40 UTC
Source: https://github.com/carlosyanez/customthemes

Help Index


Create HTML/Markdown text with Twitter's logo and handle/text

Description

Create HTML/Markdown text with Twitter's logo and handle/text

Usage

add_social_ref(twitter_handle, logo_size = 9, logo_url = NULL)

Arguments

twitter_handle

like @abcd

logo_size

(default = 9)

logo_url

custom image (i.e dark mode). If none provide, will download logo from wikimedia

Value

text


Custom theme for ggplot maps

Description

Custom theme for ggplot maps

Usage

custom_map_theme(
  google_font = "Roboto",
  map_title_size = 14,
  legend_pos = "bottom",
  legend_dir = "horizontal"
)

Arguments

google_font

font, from Google Fonts

map_title_size

Title's size

legend_pos

legend's position (default bottom)

legend_dir

legend's direction (defaul horizontal)

Value

ggplot theme object


Custom theme for ggplot maps, using ggtext for markdown text

Description

Custom theme for ggplot maps, using ggtext for markdown text

Usage

custom_map_theme_md(
  google_font = "Roboto",
  map_title_size = 14,
  map_subtitle_size = 12,
  map_caption_size = 9,
  legend_pos = "none",
  legend_dir = "horizontal",
  title_pos = "plot",
  background_colour = "white",
  plot_margin = c(3, 0, 1, 0)
)

Arguments

google_font

font, from Google Fonts

map_title_size

Title's size

map_subtitle_size

Subtitle's size

map_caption_size

Caption's size

legend_pos

legend's position (default none)

legend_dir

legend's direction (defaul horizontal)

title_pos

title's position (default plot)

background_colour

background's overall colour (default white)

plot_margin

margins c(top,right,bottom,left) - default c(3,0,1,0)


Custom theme for ggplot plots

Description

Custom theme for ggplot plots

Usage

custom_plot_theme(
  google_font = "Roboto",
  title_colour = "#272928",
  general_colour = "azure4",
  background_colour = "#fcf8f7",
  legend_pos = "right",
  legend_dir = "vertical"
)

Arguments

google_font

font, from Google Fonts

title_colour

Colour for title and legend textx

general_colour

Colour for all other texts in plot

background_colour

Background colour

legend_pos

legend's position (default right)

legend_dir

legend's direction (defaul vertical)

Value

ggplot theme object


Custom theme for ggplot plots with markdown texts

Description

Custom theme for ggplot plots with markdown texts

Usage

custom_plot_theme_md(
  google_font = "Roboto",
  title_colour = "#272928",
  general_colour = "azure4",
  background_colour = "white",
  legend_pos = "right",
  legend_dir = "vertical",
  plot_margin = c(3, 0, 1, 0),
  title_size = 14,
  subtitle_size = 12,
  caption_size = 9,
  axis_size = 10,
  legend_size = 8
)

Arguments

google_font

font, from Google Fonts

title_colour

Colour for title and legend textx

general_colour

Colour for all other texts in plot

background_colour

Background colour

legend_pos

legend's position (default right)

legend_dir

legend's direction (defaul vertical)

plot_margin

margins c(top,right,bottom,left) - default c(3,0,1,0)

title_size

Title's size

subtitle_size

Subtitle's size

caption_size

Caption's size

axis_size

text size for axis items

legend_size

text size for legend

Value

ggplot theme object


Custom theme for temperatue strips based on https://dominicroye.github.io/en/2018/how-to-create-warming-stripes-in-r/, modified

Description

Custom theme for temperatue strips based on https://dominicroye.github.io/en/2018/how-to-create-warming-stripes-in-r/, modified

Usage

custom_strip_theme(google_font = "Roboto", rbrewer_pal = "RdBu")

Arguments

google_font

font, from Google Fonts

rbrewer_pal

RColorBrewer palette used

Value

ggplot theme object


Small wrapper of formatC for number formatting

Description

Small wrapper of formatC for number formatting

Usage

digits_formatter(x, sig_digits = 3, nbr_format = "f")

Arguments

x

number to format

sig_digits

decimal precission

nbr_format

format, default "f"

Value

formatted number


save ggplot into PNG file

Description

save ggplot into PNG file

Usage

save_image(
  plot_name,
  file_name,
  dpi_value = 600,
  width_value = NA,
  height_value = NA,
  unit_value = NA
)

Arguments

plot_name

ggplot object

file_name

file's name (including .png)

dpi_value

resolution (default 600)

width_value

width for ggsave

height_value

height for ggsave

unit_value

unit for ggsave

Value

saved file in disk

ggplot theme object


Set colour for standard chart fillings and lines

Description

Set colour for standard chart fillings and lines

Usage

set_plot_colours(
  line_colour = "darkblue",
  fill_colour = "deepskyblue",
  HVline_colour = "orange",
  alt_fill_colour = "white",
  alpha_setting = 0.3
)

Arguments

line_colour

general colour for lines

fill_colour

fill colour for plots like density plots

HVline_colour

colour of vertical and horizontal lines

alt_fill_colour

fill colour for plots like boxplots

alpha_setting

alpha value when fill_colour is used

Value

no output