GitHub - JiaxiangBU/add2ggplot: The goal of add2ggplot is to add more theme for your ggplot object. (original) (raw)

add2ggplot

CRAN status DOI

The goal of add2ggplot is to add more theme for your ggplot object.

Installation

You can install the released version of add2ggplot fromCRAN with:

install.packages("add2ggplot")

And the development version from GitHub with:

install.packages("devtools")

devtools::install_github("JiaxiangBU/add2ggplot")

Examples

library(add2ggplot) #> Registered S3 methods overwritten by 'ggplot2': #> method from #> [.quosures rlang #> c.quosures rlang #> print.quosures rlang

plot_logo <- add_logo( plot_path = "inst/extdata/logo.png", logo_path = "inst/extdata/jiaxiang.png", logo_position = "bottom right", logo_scale = 5) plot_logo

library(ggrepel) #> Warning: package 'ggrepel' was built under R version 3.6.1 #> Loading required package: ggplot2 df <- mtcars %>% tibble::rownames_to_column()

df %>% ggplot() + aes(mpg, disp, label = rowname) + geom_point(color = 'white') + # geom_label_repel use fill arg in the segments. geom_label_repel( data = function(x) df %>% head, arrow = arrow(length = unit(0.02, "npc")), box.padding = 1, segment.color = white_one, color = white_one, label.size = NA, fill = red_two, aes(face = "bold") ) + # theme_white() theme_grey_and_red() + labs( title = '浣跨敤labs瑕嗙洊', subtitle = '浣跨敤labs瑕嗙洊', x = '浣跨敤labs瑕嗙洊', y = '浣跨敤labs瑕嗙洊', caption = '澶囨敞: 浣跨敤labs瑕嗙洊' ) #> Warning: Ignoring unknown aesthetics: face

z <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, col = Species)) + geom_jitter(alpha = 0.7) + scale_color_brewer( "Species", palette = "Dark2", labels = c("Setosa", "Versicolor", "Virginica") ) + scale_y_continuous("Width (cm)", limits = c(2, 4.5), expand = c(0, 0)) + scale_x_continuous("Length (cm)", limits = c(4, 8), expand = c(0, 0)) + ggtitle("Sepals") + coord_fixed(1)

z + theme_classic() #> Warning: Removed 1 rows containing missing values (geom_point).

Citations

Jiaxiang Li. (2020, February 8). JiaxiangBU/add2ggplot: add2ggplot 0.3.0 (Version v0.3.0). Zenodo. http://doi.org/10.5281/zenodo.3659696

@software{jiaxiang_li_2020_3659696, author = {Jiaxiang Li}, title = {JiaxiangBU/add2ggplot: add2ggplot 0.3.0}, month = feb, year = 2020, publisher = {Zenodo}, version = {v0.3.0}, doi = {10.5281/zenodo.3659696}, url = {https://doi.org/10.5281/zenodo.3659696} }

If you use add2ggplot, I would be very grateful if you can add a citation in your published work. By citing add2ggplot, beyond acknowledging the work, you contribute to make it more visible and guarantee its growing and sustainability. For citation, please use the BibTex or the citation content.

Code of Conduct

Please note that the add2ggplot project is released with aContributor Code of Conduct.
By contributing to this project, you agree to abide by its terms.

License