ggpointless

A Collection of Geometries, and Stats for 'ggplot2'

https://github.com/flrd/ggpointless

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.2%) to scientific vocabulary

Keywords

data-visualization ggplot2 r rstats
Last synced: 6 months ago · JSON representation

Repository

A Collection of Geometries, and Stats for 'ggplot2'

Basic Info
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 4
Topics
data-visualization ggplot2 r rstats
Created about 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
---



```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  fig.align = "center",
  fig.height = 3,
  dev = "ragg_png",
  dpi = 132
)

library(ggpointless)
```

# ggpointless 



[![CRAN status](https://www.r-pkg.org/badges/version/ggpointless)](https://CRAN.R-project.org/package=ggpointless)
[![R-CMD-check](https://github.com/flrd/ggpointless/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/flrd/ggpointless/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/flrd/ggpointless/branch/main/graph/badge.svg)](https://app.codecov.io/gh/flrd/ggpointless?branch=main)
![downloads](https://cranlogs.r-pkg.org/badges/grand-total/ggpointless))


`ggpointless` is an extension of the [`ggplot2`](https://ggplot2.tidyverse.org/) library providing additional layers. 

## Installation

You can install `ggpointless` from CRAN with:

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

To install the development version from [GitHub](https://github.com/) use:

``` {r eval=FALSE}
# install.packages("devtools")
devtools::install_github("flrd/ggpointless")
```

Once you have installed the package, attach it by calling:

```{r}
library(ggpointless)
```

## What will you get

- `geom_pointless()` -- emphasizes some observations with points
- `geom_lexis()` --	draws a Lexis diagram
- `geom_chaikin()` -- applies Chaikin's corner cutting algorithm
- `geom_catenary()` -- draws a catenary curve

See [`vignette("ggpointless")`](https://flrd.github.io/ggpointless/articles/ggpointless.html)
for details and examples.

### geom_pointless
`geom_pointless()` let's you highlight the first, or last observations, sample minimum and sample maximum to provide additional context. Or just some visual sugar. `geom_pointless()` behaves similar to `geom_point()` except that it has a `location` argument. You can set it to `"first"`, `"last"` (default), `"minimum"`, `"maximum"`, and `"all"`, where `"all"` is just shorthand to select `"first"`, `"last"`, `"minimum"` and `"maximum"`.

```{r hello-world}
cols <- c("#f4ae1b", "#d77e7b", "#a84dbd", "#311dfc")
theme_set(theme_minimal())

x <- seq(-pi, pi, length.out = 500)
y <- outer(x, 1:5, function(x, y) sin(x * y))

df1 <- data.frame(
  var1 = x,
  var2 = rowSums(y)
)

ggplot(df1, aes(x = var1, y = var2)) +
  geom_line() +
  geom_pointless(aes(color = after_stat(location)),
    location = "all",
    size = 3
  ) +
  scale_color_manual(values = cols)
```

### geom_lexis
`geom_lexis()` is a combination of a segment and a point layer. Given a start value and an end value, this function draws a 45° line which indicates the duration of an event. Required are `x` and `xend` aesthetics, `y` and `yend` coordinates will be calculated.

```{r geom-lexis, warning=FALSE}
df2 <- data.frame(
  key = c("A", "B", "B", "C", "D"),
  x = c(0, 1, 6, 5, 6),
  xend = c(5, 4, 10, 8, 10)
)

ggplot(df2, aes(x = x, xend = xend, color = key)) +
  geom_lexis(aes(linetype = after_stat(type)), size = 2) +
  coord_equal() +
  scale_x_continuous(breaks = c(df2$x, df2$xend)) +
  scale_color_manual(values = cols) +
  scale_linetype_identity() +
  theme(panel.grid.minor = element_blank())
```

See also the [`LexisPlotR` package](https://github.com/ottlngr/LexisPlotR).

### geom_chaikin

Chaikin's corner cutting algorithm let's you turn a ragged path or polygon into a smoothed one. Credit to [Farbfetzen / corner_cutting](https://github.com/Farbfetzen/corner_cutting). 

```{r geom-chaikin, warning=FALSE}
lst <- list(
  data = list(
    closed_square = data.frame(x = c(0, 0, 1, 1), y = c(2, 3, 3, 2)),
    whale = data.frame(x = c(.5, 4, 4, 3.5, 2), y = c(.5, 1, 1.5, .5, 3)),
    open_triangle = data.frame(x = c(3, 3, 5), y = c(2, 3, 3)),
    closed_triangle = data.frame(x = c(3.5, 5, 5), y = c(0, 0, 1.5))
  ),
  color = cols,
  closed = c(TRUE, TRUE, FALSE, TRUE)
)

ggplot(mapping = aes(x, y)) +
  lapply(lst$data, function(i) {
    geom_polygon(data = i, fill = NA, linetype = "12", color = "#777777")
  }) +
  Map(f = function(data, color, closed) {
    geom_chaikin(data = data, color = color, closed = closed)
  }, data = lst$data, color = lst$color, closed = lst$closed) +
  geom_point(data = data.frame(x = 1.5, y = 1.5)) +
  coord_equal()
```

See also the [`smoothr` package](https://github.com/mstrimas/smoothr/).

### geom_catenary

Draws a flexible curve that simulates a chain or rope hanging loosely between
two fixed points. By default, a chain length twice the Euclidean distance
between each x/y combination is used. See [`vignette("ggpointless")`](https://flrd.github.io/ggpointless/articles/ggpointless.html)
for details.

Credit to: [dulnan/catenary-curve](https://github.com/dulnan/catenary-curve)

```{r geom-catenary, warning=FALSE}
ggplot(data.frame(x = 1:5, y = sample(5)),
       aes(x, y)) + 
  geom_catenary() +
  geom_point(size = 3, colour = "#f4ae1b")
```


## Data

In addition to the geoms & stats, the following data sets are contained in `ggpointless`:

1. `co2_ml` : [CO~2~ records taken at Mauna Loa](https://gml.noaa.gov/ccgg/trends/data.html)
2. `covid_vac` : [COVID-19 Cases and Deaths by Vaccination Status](https://covid.cdc.gov/covid-data-tracker/#rates-by-vaccine-status)
3. `female_leaders` : [Elected and appointed female heads of state and government](https://en.wikipedia.org/w/index.php?title=List_of_elected_and_appointed_female_heads_of_state_and_government&oldid=1078024588)

For more examples call [`vignette("examples")`](https://flrd.github.io/ggpointless/articles/examples.html).

## Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](https://github.com/flrd/ggpointless/blob/main/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

Owner

  • Name: Markus Döring
  • Login: flrd
  • Kind: user

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 199
  • Total Committers: 2
  • Avg Commits per committer: 99.5
  • Development Distribution Score (DDS): 0.02
Past Year
  • Commits: 45
  • Committers: 1
  • Avg Commits per committer: 45.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
flrd m****g@g****m 195
Markus Döring f****d@u****m 4

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • flrd (1)
Pull Request Authors
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 259 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: ggpointless

Additional Geometries and Stats for 'ggplot2'

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 259 Last month
Rankings
Forks count: 21.9%
Dependent packages count: 29.8%
Stargazers count: 31.7%
Dependent repos count: 35.5%
Average: 36.9%
Downloads: 65.5%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: r-ggpointless
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 60.0%
Average: 60.6%
Stargazers count: 61.2%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • ggplot2 >= 3.3.0 depends
  • covr * suggests
  • ggrepel * suggests
  • ggtext * suggests
  • knitr * suggests
  • ragg * suggests
  • rmarkdown * suggests
  • scales * suggests
  • testthat >= 3.0.0 suggests
  • vdiffr >= 1.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lint.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite