| Title: | Add to 'ggplot2' |
|---|---|
| Description: | Create 'ggplot2' themes and color palettes. |
| Authors: | Jiaxiang Li [aut, cre] (ORCID: <https://orcid.org/0000-0003-3196-6492>), Nakagawara Ryo [aut] |
| Maintainer: | Jiaxiang Li <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.0 |
| Built: | 2026-06-03 09:25:06 UTC |
| Source: | https://github.com/jiaxiangbu/add2ggplot |
Add a logo into an image
add_logo(plot_path, logo_path, logo_position = c("top right", "top left", "bottom right", "bottom left"), logo_scale = 10)add_logo(plot_path, logo_path, logo_position = c("top right", "top left", "bottom right", "bottom left"), logo_scale = 10)
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. |
Image.
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 )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
get_width_height(img)get_width_height(img)
img |
The path of image |
The chosen color in grey
grey_onegrey_one
An object of class character of length 1.
The chosen color in grey
grey_twogrey_two
An object of class character of length 1.
more_colors helps users to build a more robust palette serving ggplot objects.
more_colors(n = 24)more_colors(n = 24)
n |
the max number of color you choose |
The vector of the colors you choose
Jiaxiang Li
more_colors(n = 12) more_colors(n = 24) more_colors(n = 36)more_colors(n = 12) more_colors(n = 24) more_colors(n = 36)
The chosen color in red
red_onered_one
An object of class character of length 1.
The chosen color in red
red_twored_two
An object of class character of length 1.
# Inspired by https://www.datacamp.com//courses/intermediate-data-visualization-with-ggplot2
theme_classic2()theme_classic2()
ggplot object.
datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_classic2()datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_classic2()
theme_du_bois is one of ggplot themes for ploting.
theme_du_bois(font_name = "")theme_du_bois(font_name = "")
font_name |
A Character. |
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.
The function to use + in the ggplot workflow.
Jiaxiang Li
datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_du_bois()datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_du_bois()
Use the ggplot theme in grey and red
theme_grey_and_red()theme_grey_and_red()
The function to use + in the ggplot workflow.
Jiaxiang Li
datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_grey_and_red()datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_grey_and_red()
One ggplot theme
theme_ilo()theme_ilo()
The function to use + in the ggplot workflow.
datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_ilo()datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_ilo()
A ggplot theme with a white background.
theme_white()theme_white()
The function to use + in the ggplot workflow.
datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_white()datasets::mtcars %>% ggplot2::ggplot(ggplot2::aes(mpg, disp)) + ggplot2::geom_point() + theme_white()
The chosen color in white
white_onewhite_one
An object of class character of length 1.