-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
80 lines (60 loc) · 2.52 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ggip <a href='https://davidchall.github.io/ggip/'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![CRAN status](https://www.r-pkg.org/badges/version/ggip)](https://CRAN.R-project.org/package=ggip)
[![R build status](https://github.com/davidchall/ggip/workflows/R-CMD-check/badge.svg)](https://github.com/davidchall/ggip/actions)
[![Coverage status](https://codecov.io/gh/davidchall/ggip/branch/master/graph/badge.svg)](https://app.codecov.io/gh/davidchall/ggip?branch=master)
<!-- badges: end -->
ggip is a [{ggplot2}](https://ggplot2.tidyverse.org) extension for visualizing IP addresses and networks stored in [{ipaddress}](https://davidchall.github.io/ipaddress/) vectors.
Here are some of the key features:
* IP data mapped to 2D plane by a **unified coordinate system**
* Compatible with **existing ggplot2 layers**
* Custom **IP-specific layers** for common use cases
* Full support for both **IPv4 and IPv6** address spaces
## Installation
You can install the released version of ggip from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("ggip")
```
Or you can install the development version from GitHub:
``` r
# install.packages("remotes")
remotes::install_github("davidchall/ggip")
```
## Usage
Plotting with {ggip} follows most of the conventions set by [{ggplot2}](https://ggplot2.tidyverse.org).
A major difference is that `coord_ip()` is required to map IP data to the 2D grid (addresses to points and networks to rectangles).
Learn more in `vignette("ggip")`.
Here's a quick showcase of what's possible:
```{r ipv4-heatmap, fig.width=11.2, fig.height=10.3}
library(tidyverse)
library(ggfittext)
library(ggip)
ggplot(ip_data) +
stat_summary_address(aes(ip = address)) +
geom_hilbert_outline(color = "grey80") +
geom_fit_text(
aes(
xmin = network$xmin, xmax = network$xmax,
ymin = network$ymin, ymax = network$ymax,
label = label
),
data = iana_ipv4 %>% filter(allocation == "Reserved"),
color = "#fdc086", grow = TRUE
) +
scale_fill_viridis_c(name = NULL, trans = "log2", na.value = "black") +
coord_ip(pixel_prefix = 20) +
theme_ip_dark()
```