Learn R Programming

ggip (version 0.3.2)

ip_to_cartesian: Map IP data to Cartesian coordinates

Description

These functions are used internally by coord_ip() to map ip_address and ip_network vectors to Cartesian coordinates. They are exposed externally to support use of these coordinates outside of ggplot2.

Usage

address_to_cartesian(
  address,
  canvas_network = ip_network("0.0.0.0/0"),
  pixel_prefix = 16,
  curve = c("hilbert", "morton")
)

network_to_cartesian( network, canvas_network = ip_network("0.0.0.0/0"), pixel_prefix = 16, curve = c("hilbert", "morton") )

Value

A data.frame containing columns:

  • address_to_cartesian(): x and y

  • network_to_cartesian(): xmin, ymin, xmax and ymax

Arguments

address

An ip_address vector

canvas_network

An ip_network scalar that determines the region of IP space visualized by the entire 2D grid. The default shows the entire IPv4 address space.

pixel_prefix

An integer scalar that sets the prefix length of the network represented by a single pixel. The default value is 16. Increasing this effectively improves the resolution of the plot.

curve

A string to choose the space-filling curve. Choices are "hilbert" (default) and "morton".

network

An ip_network vector

Examples

Run this code
address_to_cartesian(ip_address("192.168.0.1"))

network_to_cartesian(ip_network("224.0.0.0/4"))

Run the code above in your browser using DataLab