Skip to content

Commit

Permalink
redoc
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Jan 29, 2024
1 parent 3be75ff commit 5d3703e
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Suggests:
covr,
sf
LinkingTo: Rcpp
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Depends:
R (>= 2.10),
ggplot2 (>= 3.0.0)
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

S3method(as.data.frame,layout_ggraph)
S3method(autograph,default)
S3method(collect_connections,default)
S3method(collect_edges,default)
S3method(collect_edges,layout_tbl_graph)
S3method(create_layout,default)
S3method(create_layout,layout_ggraph)
S3method(create_layout,tbl_graph)
Expand Down
1 change: 1 addition & 0 deletions R/connections.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ get_con <- function(from = integer(), to = integer(), paths = NULL, ..., weight
collect_connections <- function(layout, from, to, ...) {
UseMethod('collect_connections', layout)
}
#' @export
collect_connections.default <- function(layout, ...) {
cli::cli_abort('Don\'t know how to get connections from an object of class {.cls {class(layout)[1]}}')
}
1 change: 1 addition & 0 deletions R/edges.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ get_edges <- function(format = 'short', collapse = 'none', ...) {
collect_edges <- function(layout) {
UseMethod('collect_edges', layout)
}
#' @export
collect_edges.default <- function(layout) {
attr(layout, 'edges')
}
Expand Down
2 changes: 1 addition & 1 deletion R/geom_edge_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ geom_edge_sf <- function(mapping = NULL, data = get_sf_edges(),
coord_sf(default = TRUE)
)
}

#' @rdname get_edges
get_sf_edges <- function(){
function(layout) {
edges <- sf::st_as_sf(attr(layout, "graph"), "edges")
Expand Down
3 changes: 2 additions & 1 deletion R/geom_node_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ geom_node_sf <- function(mapping = NULL, data = get_sf_nodes(),
)
}

#' @rdname get_nodes
get_sf_nodes <- function(){
function(layout) {
nodes <- sf::st_as_sf(layout)
attr(nodes, 'type_ggraph') <- 'node_ggraph'
nodes
}
}
}
1 change: 1 addition & 0 deletions R/tbl_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ create_layout.tbl_graph <- function(graph, layout, circular = FALSE, ...) {
)
check_layout(layout)
}
#' @export
collect_edges.layout_tbl_graph <- function(layout) {
gr <- attr(layout, 'graph')
edges <- as_tibble(gr, active = 'edges')
Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ reference:
- layout_tbl_graph_matrix
- layout_tbl_graph_hive
- layout_tbl_graph_fabric
- layout_tbl_graph_sf
- layout_tbl_graph_metro
- title: "Nodes"
desc: >
While nodes are often thought of as points in a hairball graph, they are
Expand All @@ -91,6 +93,7 @@ reference:
- geom_node_circle
- geom_node_arc_bar
- geom_node_range
- geom_node_sf
- title: "Edges"
desc: >
Edges are the entities connecting nodes, often drawn with some sort of
Expand All @@ -113,6 +116,7 @@ reference:
- geom_edge_bundle_force
- geom_edge_bundle_path
- geom_edge_bundle_minimal
- geom_edge_sf
- title: "Connections"
desc: >
Connections are meta-edges, connecting nodes that are not direct
Expand Down
2 changes: 1 addition & 1 deletion man/get_con.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions man/get_edges.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions man/get_nodes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/ggraph-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/layout_tbl_graph_metro.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/layout_tbl_graph_sf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d3703e

Please sign in to comment.