gghexsize

Make Hexagonal Heatmaps with Varying Hexagon Sizes

https://github.com/hrryt/gghexsize

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

Keywords

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

Repository

Make Hexagonal Heatmaps with Varying Hexagon Sizes

Basic Info
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
data-visualisation data-visualization ggplot-extension ggplot2 r rstats
Created 10 months ago · Last pushed 9 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 = "100%",
  dpi = 300
)
```

# gghexsize




The goal of gghexsize is mainly to provide users with the ability to
vary the size of each hexagon in hexagonal heatmaps created with ggplot2.

## Installation

You can install gghexsize using the following command:

``` r
install.packages("gghexsize")
```

You can install the development version of gghexsize from [GitHub](https://github.com/) with:

``` r
# install.packages("pak")
pak::pak("hrryt/gghexsize")
```

## Example

This is a basic example of a hexagonal heatmap of diamond prices: 

```{r setup}
library(ggplot2)
library(gghexsize)

p <- ggplot(diamonds, aes(carat, depth, z = price)) +
  scale_x_continuous(
    name = "Carat",
    limits = c(0, 3)
  ) +
  scale_y_continuous(
    name = "Total depth percentage",
    label = ~sprintf("%i%%", .x),
    limits = c(50, 75)
  ) +
  scale_fill_viridis_c(
    name = "Median price / $1000",
    label = ~.x / 1000
  )
```

The size of each hexagon scales with number of cases by default.

Use `scale_size_tile()` to scale size between 0 and 1, with values outside the limits
being 'squished' to the nearest limit.

The hextile key glyph includes a transparent background hexagon of size 1
for easy perceptual comparison with maximally tiled hexagons:

```{r}
p +
  geom_hextile(fun = "median", na.rm = TRUE) +
  scale_size_tile(name = "Number of diamonds", limits = c(0, 100))
```

The statistic paired with `geom_hextile()`, `stat_summary_hextile()`,
offers all the aesthetics and computed variables of `stat_bin_hex()`
(and of `stat_summary_hex()`):

```{r}
p +
  geom_hextile(
    aes(weight = price, size = after_stat(ndensity)),
    fun = "median", na.rm = TRUE
  ) +
  scale_size_tile(name = "Price-weighted density", limits = c(0, 0.1))
```

You can provide between 0 and 3 `z` aesthetics to `stat_summary_hextile()`:

```{r}
ggplot(diamonds, aes(carat, depth, fill = NULL)) +
  geom_hextile(colour = "black", fill = scales::muted("lightblue")) +
  scale_size_tile(limits = c(0, 100))

ggplot(diamonds, aes(
  carat, depth, z = price, z2 = as.numeric(cut), z3 = table, group = 1,
  alpha = after_stat(value2), colour = after_stat(value3)
)) + 
  geom_hextile() +
  scale_size_tile(limits = c(0, 100)) +
  labs(title = "Contrived example with way too many aesthetics")
```

Owner

  • Login: hrryt
  • Kind: user

GitHub Events

Total
  • Create event: 4
  • Release event: 1
  • Issues event: 3
  • Watch event: 4
  • Push event: 32
Last Year
  • Create event: 4
  • Release event: 1
  • Issues event: 3
  • Watch event: 4
  • Push event: 32

Packages

  • Total packages: 1
  • Total downloads:
    • cran 170 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: gghexsize

Make Hexagonal Heatmaps with Varying Hexagon Sizes

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 170 Last month
Rankings
Dependent packages count: 26.5%
Forks count: 29.0%
Dependent repos count: 32.7%
Stargazers count: 37.3%
Average: 42.4%
Downloads: 86.7%
Maintainers (1)
Last synced: 6 months ago