Autoplot function for xmap_df objects
autoplot.xmap.Rd
This function generates a plot of an xmap_df object using the ggraph and ggplot2 packages. It visualizes the relationships between nodes and edges in the xmap_df object, with different styles for unit weight and fractional weight links, and prints fractional weights on edges.
Usage
# S3 method for xmap_df
autoplot(object, ...)
# S3 method for xmap_df
plot(x, ...)
Examples
library(ggplot2)
library(ggraph)
library(tidygraph)
#>
#> Attaching package: ‘tidygraph’
#> The following object is masked from ‘package:stats’:
#>
#> filter
library(xmap)
df <- data.frame(from = c("A", "A", "B", "B", "B"),
to = c("X", "Y", "X", "Y", "Z"),
weights = c(0.6, 0.4, 0.2, 0.7, 0.1))
xmap <- as_xmap_df(df, from, to, weights)
#> Dropping any additional columns in `df`
#> ℹ To silence set `.drop_extra = TRUE`
autoplot(xmap)