Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://jiaxiangbu.github.io/add2ggplot/
The goal of add2ggplot is to add more theme for your ggplot object.
https://jiaxiangbu.github.io/add2ggplot/
ggplot-extension ggplot2-theme
Last synced: 2 days ago
JSON representation
The goal of add2ggplot is to add more theme for your ggplot object.
- Host: GitHub
- URL: https://jiaxiangbu.github.io/add2ggplot/
- Owner: JiaxiangBU
- License: other
- Created: 2019-03-21T04:13:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-08T12:07:58.000Z (almost 5 years ago)
- Last Synced: 2024-08-03T23:24:18.359Z (3 months ago)
- Topics: ggplot-extension, ggplot2-theme
- Language: R
- Homepage: https://jiaxiangbu.github.io/add2ggplot/
- Size: 506 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# add2ggplot
[![CRAN status](https://www.r-pkg.org/badges/version/add2ggplot)](https://CRAN.R-project.org/package=add2ggplot)
[![DOI](https://zenodo.org/badge/176868456.svg)](https://zenodo.org/badge/latestdoi/176868456)The goal of add2ggplot is to add more theme for your ggplot object.
## Installation
You can install the released version of add2ggplot from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("add2ggplot")
```And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("JiaxiangBU/add2ggplot")
```
## Examples```{r}
library(add2ggplot)
``````{r}
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
``````{r}
library(ggrepel)
df <-
mtcars %>%
tibble::rownames_to_column()
``````{r}
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瑕嗙洊'
)
``````{r}
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)
``````{r}
z
z + theme_classic()
z + theme_classic2()
```## Citations
```{r include=FALSE}
citations <- add2pkg::add_zenodo_citation("README.Rmd")
``````{r echo=FALSE, results='asis'}
cat(citations$Cite)
``````{r echo=FALSE, results='asis'}
cat(paste0("```BibTex\n",citations$BibTex,"\n```"))
``````{r echo=FALSE, results='asis'}
cat(citations$Comments)
````r add2pkg::add_disclaimer("Jiaxiang Li;Nakagawara Ryo")`