Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://botan.github.io/ggrounded/

Rounded Bar Plots
https://botan.github.io/ggrounded/

Last synced: 2 days ago
JSON representation

Rounded Bar Plots

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%",
dpi = 144
)
```

# ggrounded

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/botan/ggrounded/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/botan/ggrounded/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/botan/ggrounded/branch/main/graph/badge.svg)](https://app.codecov.io/gh/botan/ggrounded?branch=main)
[![CRAN status](https://www.r-pkg.org/badges/version/ggrounded)](https://CRAN.R-project.org/package=ggrounded)

ggrounded creates bar plots with rounded corners using ggplot2.

## Installation

Install the released version of ggrounded from CRAN:

```{r, eval = FALSE}
install.packages("ggrounded")
```

Or install the development version from GitHub with:

```{r, eval = FALSE}
# install.packages("pak")
pak::pak("botan/ggrounded")
```

## Usage

There are two types of bar charts in ggplot2: `geom_bar()` and `geom_col()`. `geom_bar_rounded()` and `geom_col_rounded()` are wrappers on them for rounding the top corners. `geom_bar_rounded()` makes the height of the bar proportional to the number of cases in each group (or if the `weight` aesthetic is supplied, the sum of the weights).

```{r example1}
library(ggrounded)
library(ggplot2)

ggplot(mpg, aes(class)) +
geom_bar_rounded()
```

If you want the heights of the bars to represent values in the data, use `geom_col_rounded()` instead.

```{r example2}
ggplot(data.frame(x = letters[1:3], y = c(2.3, 1.9, 3.2)), aes(x, y)) +
geom_col_rounded()
```

## Code of Conduct

Please note that the ggrounded is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html). By contributing in this project you agree to abide by its terms.

## License

This package is released under the MIT License.