Science Score: 26.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
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.2%) to scientific vocabulary
Keywords
ggplot2
spatial
visualisation
Last synced: 6 months ago
·
JSON representation
Repository
Add vector fields layers to ggplots
Basic Info
- Host: GitHub
- Owner: pepijn-devries
- License: gpl-3.0
- Language: R
- Default Branch: master
- Homepage: https://pepijn-devries.github.io/ggfields/
- Size: 9.1 MB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
ggplot2
spatial
visualisation
Created about 2 years ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "70%",
fig.ext = "svg",
dev = "ggsave"
)
```
# ggfields
## Overview
[](https://github.com/pepijn-devries/ggfields/actions/workflows/R-CMD-check.yaml)

[](https://CRAN.R-project.org/package=ggfields)
[](https://cran.r-project.org/web/checks/check_results_ggfields.html)
[](https://pepijn-devries.r-universe.dev/ggfields)
[](https://app.codecov.io/gh/pepijn-devries/ggfields)
Add vector field layers to your `ggplot2::ggplot()`. Although it has similarities
with `ggplot2::geom_spoke()`, `ggfields` offers some distinct features:
* The `radius` aesthetic is mapped to a scale and therefore can be added
to the guides (see `vignette("radius_aes")`).
* Not only `data.frame`s are supported, but also geometric data
(`sf::st_sf()` and `stars::st_as_stars()`).
* Corrects angles for displayed aspect ratio or coordinate system
(see `vignette("angle_correction")`).
## Installation
> Get CRAN version
```{r eval=FALSE}
install.packages("ggfields")
```
> Get development version from r-universe
```{r eval=FALSE}
install.packages("ggfields", repos = c("https://pepijn-devries.r-universe.dev", "https://cloud.r-project.org"))
```
## Adding vector fields to a map
The example below shows how seawater current data can be added to a map:
```{r init, results = 'hide', message = FALSE}
library(ggplot2)
library(ggfields)
library(ggspatial) ## For annotating with Open Street Map
```
```{r theme, echo = FALSE}
theme_set(theme_light())
set.seed(0)
```
```{r map, results = 'hide', message = FALSE, fig.width = 5, fig.height = 7, out.width = "50%"}
data(seawatervelocity)
ggplot() +
ggspatial::annotation_map_tile(
alpha = 0.25,
cachedir = tempdir()) +
geom_fields(
data = seawatervelocity,
aes(radius = as.numeric(v),
angle = as.numeric(angle),
colour = as.numeric(v)),
max_radius = grid::unit(0.7, "cm")) +
labs(colour = "v[m/s]",
radius = "v[m/s]") +
scale_radius_binned() +
scale_colour_viridis_b(guide = guide_bins())
```
## Simple data.frames
Vector arrows can also be added to simple plots with `x` and `y` data:
```{r dataframe, results = 'hide', message = FALSE}
## First generate some arbitrary data to plot:
n <- 10
df <- data.frame(x = seq(0, 100, length.out = n), y = rnorm(n),
ang = seq(0, 2*pi, length.out = n))
df$len <- 2 + df$y + rnorm(n)/4
ggplot(df, aes(x = x, y = y)) +
geom_line() +
geom_fields(aes(angle = ang, radius = len), .angle_correction = NULL)
```
Owner
- Login: pepijn-devries
- Kind: user
- Twitter: pepijn_devries
- Repositories: 3
- Profile: https://github.com/pepijn-devries
GitHub Events
Total
- Issues event: 1
- Issue comment event: 8
- Push event: 6
- Pull request event: 3
Last Year
- Issues event: 1
- Issue comment event: 8
- Push event: 6
- Pull request event: 3
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 8
- Average time to close issues: 1 day
- Average time to close pull requests: about 1 hour
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 5.0
- Average comments per pull request: 0.13
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 2
- Average time to close issues: 1 day
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 5.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- teunbrand (1)
Pull Request Authors
- pepijn-devries (8)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 130 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: ggfields
Add Vector Field Layers to Ggplots
- Homepage: https://pepijn-devries.github.io/ggfields/
- Documentation: http://cran.r-project.org/web/packages/ggfields/ggfields.pdf
- License: GPL (≥ 3)
-
Latest release: 0.0.7
published 8 months ago
Rankings
Dependent packages count: 28.2%
Dependent repos count: 36.1%
Average: 49.6%
Downloads: 84.4%
Maintainers (1)
Last synced:
6 months ago
Dependencies
.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
DESCRIPTION
cran
- R >= 4.1.0 depends
- dplyr >= 1.1.4 imports
- ggplot2 >= 3.4.4 imports
- grid >= 4.3.2 imports
- rlang >= 1.1.2 imports
- scales >= 1.3.0 imports
- sf >= 1.0 imports
- CopernicusMarine * suggests
- knitr * suggests
- rmarkdown * suggests
- stars >= 0.6 suggests
- svglite >= 2.1.3 suggests
- testthat >= 3.0.0 suggests
- vdiffr >= 1.0.7 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/check-r-package 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 v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite