ggstance

Horizontal ggplot2 components

https://github.com/lionel-/ggstance

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 (9.5%) to scientific vocabulary

Keywords from Contributors

visualisation tidy-data gdal geos proj setup testthat graphics parquet arrow
Last synced: 11 months ago · JSON representation

Repository

Horizontal ggplot2 components

Basic Info
  • Host: GitHub
  • Owner: lionel-
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 1.91 MB
Statistics
  • Stars: 203
  • Watchers: 9
  • Forks: 19
  • Open Issues: 6
  • Releases: 8
Created over 10 years ago · Last pushed about 2 years ago
Metadata Files
Readme

README.md

Lifecycle: superseded R-CMD-check <!-- badges: end -->

ggstance

Important: This package has been superseded by ggplot2 3.3.0, which now has full native support for horizontality. The ggstance package will continue to be maintained for some time, but please consider switching to ggplot2.

Installation

Get the development version from Github with:

```R

install.packages("devtools")

devtools::install_github("lionel-/ggstance") ```

Horizontal geoms

While coord_flip() can only flip a plot as a whole, ggstance provides flipped versions of Geoms, Stats and Positions. This makes it easier to build horizontal layer or use vertical positioning (e.g. vertical dodging). Also, horizontal Geoms draw horizontal legend keys to keep the appearance of your plots consistent.

Horizontal Geoms:

  • geom_barh()
  • geom_colh()
  • geom_histogramh()
  • geom_linerangeh()
  • geom_pointrangeh()
  • geom_errorbarh()
  • geom_crossbarh()
  • geom_boxploth()
  • geom_violinh()

Horizontal Stats:

  • stat_binh()
  • stat_boxploth()
  • stat_counth()
  • stat_xdensity()
  • stat_summaryh()

Vertical Positions:

  • position_dodgev()
  • position_dodge2v()
  • position_nudgev()
  • position_fillv()
  • position_stackv()
  • position_jitterdodgev()

Examples

Basics

To create a horizontal layer in ggplot2 with coord_flip(), you have to supply aesthetics as if they were to be drawn vertically:

```r library("ggplot2")

Vertical

ggplot(mpg, aes(class, hwy, fill = factor(cyl))) + geom_boxplot()

Horizontal with coord_flip()

ggplot(mpg, aes(class, hwy, fill = factor(cyl))) + geomboxplot() + coordflip() ```

In ggstance, you supply aesthetics in their natural order:

```r library("ggstance")

Horizontal with ggstance

ggplot(mpg, aes(hwy, class, fill = factor(cyl))) + geom_boxploth() ```

Horizontal boxplot

Facetting with Free Scales

Some plots are hard to produce with coord_flip(). One case is facetting with free scales. Here is an example from @smouksassi:

```r library("ggplot2") library("ggstance")

df <- data.frame( Group = factor(rep(1:3, each = 4), labels = c("Drug A", "Drug B", "Control")), Subject = factor(rep(1:6, each = 2), labels = c("A", "B", "C", "D", "E", "F")), Result = rnorm(12) )

vertical <- ggplot(df, aes(Subject, Result))+ geomboxplot(aes(fill = Group))+ facetgrid(. ~ Group, scales = "free_x") vertical ```

How do we flip this plot? With coord_flip(), the free scales are not flipped correctly:

r vertical + coord_flip() vertical + facet_grid(Group ~ ., scales = "free_x") + coord_flip()

On the other hand a ggstance horizontal layer will work properly:

r horizontal <- ggplot(df, aes(Result, Subject))+ geom_boxploth(aes(fill = Group))+ facet_grid(Group ~ ., scales = "free_y") horizontal

Horizontal free-scales facetting

Using vertical positions

In this example we use vertical dodging to align measurements within subgroups.

```{r} data <- expand.grid( Group = c("A", "B"), Subgroup = c("a", "b", "c"), y = 1:10 ) data$y <- sample(1:4, replace = TRUE, size = nrow(data))

ggplot(data, aes(y, Group, colour = Subgroup)) + statsum(position = positiondodgev(height = 0.5)) ```

Vertical positions

Owner

  • Name: Lionel Henry
  • Login: lionel-
  • Kind: user
  • Company: @posit-pbc

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 145
  • Total Committers: 9
  • Avg Commits per committer: 16.111
  • Development Distribution Score (DDS): 0.069
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Lionel Henry l****y@g****m 135
rjbgoudie r****e 2
Michael Chirico m****4@g****m 2
Thomas Lin Pedersen t****5@g****m 1
Praer (Suthira Owlarn) s****n@g****m 1
Joseph M. Burling j****g@g****m 1
Frie f****e@p****e 1
Frederik Tiedemann f****n@g****m 1
Dewey Dunnington d****y@f****t 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 32
  • Total pull requests: 15
  • Average time to close issues: 4 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 24
  • Total pull request authors: 10
  • Average comments per issue: 1.69
  • Average comments per pull request: 0.8
  • Merged pull requests: 12
  • 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
  • rpruim (3)
  • lionel- (2)
  • GuangchuangYu (2)
  • Generalized (2)
  • eipi10 (2)
  • hadley (2)
  • bbolker (2)
  • seth-1 (1)
  • Ax3man (1)
  • Enchufa2 (1)
  • lucyannewinder (1)
  • huftis (1)
  • smouksassi (1)
  • krlmlr (1)
  • paleolimbot (1)
Pull Request Authors
  • lionel- (4)
  • thomasp85 (2)
  • teunbrand (2)
  • MichaelChirico (2)
  • paleolimbot (1)
  • iamamutt (1)
  • friep (1)
  • sowla (1)
  • erocoar (1)
  • rjbgoudie (1)
Top Labels
Issue Labels
tidy-dev-day :nerd_face: (1)
Pull Request Labels
tidy-dev-day :nerd_face: (1)

Packages

  • Total packages: 2
  • Total downloads:
    • cran 6,832 last-month
  • Total docker downloads: 54,621
  • Total dependent packages: 19
    (may contain duplicates)
  • Total dependent repositories: 36
    (may contain duplicates)
  • Total versions: 16
  • Total maintainers: 1
proxy.golang.org: github.com/lionel-/ggstance
  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.5%
Average: 6.7%
Dependent repos count: 6.9%
Last synced: 11 months ago
cran.r-project.org: ggstance

Horizontal 'ggplot2' Components

  • Versions: 8
  • Dependent Packages: 19
  • Dependent Repositories: 36
  • Downloads: 6,832 Last month
  • Docker Downloads: 54,621
Rankings
Stargazers count: 2.1%
Downloads: 3.5%
Dependent packages count: 3.7%
Forks count: 3.9%
Dependent repos count: 4.3%
Average: 6.9%
Docker downloads count: 23.5%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.1.0 depends
  • ggplot2 >= 3.2.0 imports
  • plyr * imports
  • rlang * imports
  • withr >= 2.0.0 imports
  • Hmisc * suggests
  • covr * suggests
  • testthat * suggests
  • vdiffr >= 0.3.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/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/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push 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