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")
)
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
Value
A data.frame containing columns:
address_to_cartesian()
:x
andy
network_to_cartesian()
:xmin
,ymin
,xmax
andymax
Examples
address_to_cartesian(ip_address("192.168.0.1"))
#> x y
#> 1 241 142
network_to_cartesian(ip_network("224.0.0.0/4"))
#> xmin ymin xmax ymax
#> 1 128 192 191 255