suppressPackageStartupMessages(library(dplyr))
tibble(address = ip_address(c("0.0.0.0", "128.0.0.0", "192.168.0.1"))) %>%
ggplot(aes(x = address$x, y = address$y, label = address$ip)) +
geom_point() +
geom_label(nudge_x = c(10, 0, -10), nudge_y = -10) +
coord_ip(expand = TRUE) +
theme_ip_light()
tibble(network = ip_network(c("0.0.0.0/8", "224.0.0.0/4"))) %>%
mutate(
start = network_address(network),
end = broadcast_address(network)
) %>%
ggplot() +
geom_point(aes(x = start$x, y = start$y), color = "blue") +
geom_point(aes(x = end$x, y = end$y), color = "red") +
geom_rect(
aes(xmin = network$xmin, xmax = network$xmax, ymin = network$ymin, ymax = network$ymax),
alpha = 0.5, fill = "grey"
) +
coord_ip(curve = "morton", expand = TRUE) +
theme_ip_light()
Run the code above in your browser using DataLab