Title: Add to 'ggplot2'
Version: 0.3.0
Description: Create 'ggplot2' themes and color palettes.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports: ggplot2, magrittr, RColorBrewer, magick, zeallot
URL: https://github.com/JiaxiangBU/add2ggplot
BugReports: https://github.com/JiaxiangBU/add2ggplot/issues
RoxygenNote: 6.1.1
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2020-01-27 07:03:24 UTC; lijiaxiang
Author: Jiaxiang Li ORCID iD [aut, cre], Nakagawara Ryo [aut]
Maintainer: Jiaxiang Li <alex.lijiaxiang@foxmail.com>
Repository: CRAN
Date/Publication: 2020-02-07 11:50:02 UTC

Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Description

Add a logo into an image

Usage

add_logo(plot_path, logo_path, logo_position = c("top right", "top left",
  "bottom right", "bottom left"), logo_scale = 10)

Arguments

plot_path

image path.

logo_path

logo image path.

logo_position

the position of logo within the image.

logo_scale

the size of logo relative to the image.

Value

Image.

Examples

add_logo(
    plot_path = system.file("extdata", "logo.png", package = "add2ggplot"),
    logo_path = system.file("extdata", "jiaxiang.png", package = "add2ggplot"),
    logo_position = "bottom right",
    logo_scale = 5
)

Get image width and height

Description

Get image width and height

Usage

get_width_height(img)

Arguments

img

The path of image


The chosen color in grey

Description

The chosen color in grey

Usage

grey_one

Format

An object of class character of length 1.


The chosen color in grey

Description

The chosen color in grey

Usage

grey_two

Format

An object of class character of length 1.


Use a palette with 24 colors

Description

more_colors helps users to build a more robust palette serving ggplot objects.

Usage

more_colors(n = 24)

Arguments

n

the max number of color you choose

Value

The vector of the colors you choose

Author(s)

Jiaxiang Li

Examples

more_colors(n = 12)
more_colors(n = 24)
more_colors(n = 36)

The chosen color in red

Description

The chosen color in red

Usage

red_one

Format

An object of class character of length 1.


The chosen color in red

Description

The chosen color in red

Usage

red_two

Format

An object of class character of length 1.


Another classic theme

Description

# Inspired by https://www.datacamp.com//courses/intermediate-data-visualization-with-ggplot2

Usage

theme_classic2()

Value

ggplot object.

Examples

datasets::mtcars %>%
  ggplot2::ggplot(ggplot2::aes(mpg, disp)) +
  ggplot2::geom_point() +
  theme_classic2()

Use Du Bois's theme

Description

theme_du_bois is one of ggplot themes for ploting.

Usage

theme_du_bois(font_name = "")

Arguments

font_name

A Character.

Details

The function I developed originates from this GitHub Repository by the statistician Matthew A. He reproduces the sort of images originated from W.E.B. Du Bois.

Value

The function to use + in the ggplot workflow.

Author(s)

Jiaxiang Li

Examples

datasets::mtcars %>%
  ggplot2::ggplot(ggplot2::aes(mpg, disp)) +
  ggplot2::geom_point() +
  theme_du_bois()

Use the ggplot theme in grey and red

Description

Use the ggplot theme in grey and red

Usage

theme_grey_and_red()

Value

The function to use + in the ggplot workflow.

Author(s)

Jiaxiang Li

Examples

datasets::mtcars %>%
  ggplot2::ggplot(ggplot2::aes(mpg, disp)) +
  ggplot2::geom_point() +
  theme_grey_and_red()

One ggplot theme

Description

One ggplot theme

Usage

theme_ilo()

Value

The function to use + in the ggplot workflow.

Examples

datasets::mtcars %>%
  ggplot2::ggplot(ggplot2::aes(mpg, disp)) +
  ggplot2::geom_point() +
  theme_ilo()

A ggplot theme with a white background.

Description

A ggplot theme with a white background.

Usage

theme_white()

Value

The function to use + in the ggplot workflow.

Examples

datasets::mtcars %>%
  ggplot2::ggplot(ggplot2::aes(mpg, disp)) +
  ggplot2::geom_point() +
  theme_white()

The chosen color in white

Description

The chosen color in white

Usage

white_one

Format

An object of class character of length 1.