Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Suggests:
sfnetworks
LinkingTo:
cpp11
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Depends:
R (>= 2.10),
ggplot2 (>= 3.5.0)
Expand Down
7 changes: 3 additions & 4 deletions R/geom_node_arc_bar.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' as created with circular partition layouts
#'
#' @section Aesthetics:
#' `geom_node_point` understand the following aesthetics. Bold aesthetics are
#' `geom_node_arc_bar` understand the following aesthetics. Bold aesthetics are
#' automatically set, but can be overwritten.
#'
#' - **x0**
Expand All @@ -18,9 +18,8 @@
#' - alpha
#' - colour
#' - fill
#' - shape
#' - size
#' - stroke
#' - linewidth
#' - linetype
#' - filter
#'
#' @inheritParams ggforce::geom_circle
Expand Down
5 changes: 2 additions & 3 deletions R/geom_node_circle.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
#' - alpha
#' - colour
#' - fill
#' - shape
#' - size
#' - stroke
#' - linewidth
#' - linetype
#' - filter
#'
#' @inheritParams ggforce::geom_circle
Expand Down
4 changes: 2 additions & 2 deletions R/geom_node_range.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' layout for showing the horizontal span of each node.
#'
#' @section Aesthetics:
#' `geom_node_point` understand the following aesthetics. Bold aesthetics are
#' `geom_node_range` understand the following aesthetics. Bold aesthetics are
#' automatically set, but can be overwritten.
#'
#' - **x**
Expand All @@ -14,7 +14,7 @@
#' - alpha
#' - colour
#' - linetype
#' - size
#' - linewidth
#' - filter
#'
#' @inheritParams ggplot2::geom_linerange
Expand Down
10 changes: 4 additions & 6 deletions R/geom_node_tile.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
#'
#' A treemap is a space filling layout that recursively divides a rectangle to
#' the children of the node. Often only the leaf nodes are drawn as nodes higher
#' up in the hierarchy would obscure what is below. `geom_treemap` is a
#' shorthand for `geom_node_treemap` as node is implicit in the case of
#' treemap drawing
#' up in the hierarchy would obscure what is below.
#'
#' @section Aesthetics:
#' `geom_treemap` understand the following aesthetics. Bold aesthetics are
#' `geom_node_tile` understand the following aesthetics. Bold aesthetics are
#' automatically set, but can be overwritten.
#'
#' - **x**
Expand All @@ -17,8 +15,8 @@
#' - alpha
#' - colour
#' - fill
#' - size
#' - stroke
#' - linewidth
#' - linetype
#' - filter
#'
#' @inheritParams ggplot2::geom_tile
Expand Down
5 changes: 2 additions & 3 deletions R/geom_node_voronoi.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
#' - alpha
#' - colour
#' - fill
#' - shape
#' - size
#' - stroke
#' - linewidth
#' - linetype
#' - filter
#'
#' @inheritParams ggforce::geom_voronoi_tile
Expand Down
35 changes: 15 additions & 20 deletions R/scale_edge_width.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#' Edge width scales
#'
#' This set of scales defines width scales for edge geoms. Of all the new edge
#' scales defined in ggraph, this is the only one not having an equivalent in
#' ggplot2. In essence it mimics the use of size in
#' [ggplot2::geom_line()] and related. As almost all edge
#' representations are lines of some sort, edge_width will be used much more
#' often than edge_size. It is not necessary to spell out that it is an edge
#' scale as the geom knows if it is drawing an edge. Just write `width` and
#' This set of scales defines width scales for edge geoms. In essence it mimics
#' the use of `linewidth` in [ggplot2::geom_line()] and related. As almost all
#' edge representations are lines of some sort, `edge_width` will be used much
#' more often than `edge_size`. It is not necessary to spell out that it is an
#' edge scale as the geom knows if it is drawing an edge. Just write `width` and
#' not `edge_width` in the call to geoms.
#'
#' @return A ggproto object inheriting from `Scale`
Expand All @@ -20,7 +18,7 @@ NULL

#' @rdname scale_edge_width
#'
#' @inheritParams ggplot2::scale_size_continuous
#' @inheritParams ggplot2::scale_linewidth_continuous
#'
#' @export
scale_edge_width_continuous <- function(
Expand All @@ -32,7 +30,7 @@ scale_edge_width_continuous <- function(
trans = "identity",
guide = "legend"
) {
sc <- scale_radius(
sc <- scale_linewidth_continuous(
name = name,
breaks = breaks,
labels = labels,
Expand All @@ -41,7 +39,6 @@ scale_edge_width_continuous <- function(
trans = trans,
guide = guide
)
sc$scale_name <- 'width_c'
sc$aesthetics <- 'edge_width'
sc
}
Expand All @@ -51,20 +48,19 @@ scale_edge_width_continuous <- function(
scale_edge_width <- scale_edge_width_continuous
#' @rdname scale_edge_width
#'
#' @inheritParams ggplot2::scale_size_discrete
#' @inheritParams ggplot2::scale_linewidth_discrete
#' @export
scale_edge_width_discrete <- function(...) {
cli::cli_warn(
"Using {.field edge_width} for a discrete variable is not advised."
)
sc <- scale_size_ordinal(...)
sc$scale_name <- 'width_d'
sc <- scale_linewidth_ordinal(...)
sc$aesthetics <- 'edge_width'
sc
}
#' @rdname scale_edge_width
#'
#' @inheritParams ggplot2::scale_size_binned
#' @inheritParams ggplot2::scale_linewidth_binned
#' @export
scale_edge_width_binned <- function(
name = waiver(),
Expand All @@ -77,7 +73,7 @@ scale_edge_width_binned <- function(
trans = "identity",
guide = "bins"
) {
sc <- scale_size_binned(
sc <- scale_linewidth_binned(
name = name,
breaks = breaks,
labels = labels,
Expand All @@ -88,13 +84,12 @@ scale_edge_width_binned <- function(
trans = trans,
guide = guide
)
sc$scale_name <- 'width_b'
sc$aesthetics <- 'edge_width'
sc
}
#' @rdname scale_edge_width
#'
#' @inheritParams ggplot2::scale_size_manual
#' @inheritParams ggplot2::scale_linewidth_manual
#'
#' @export
scale_edge_width_manual <- function(
Expand All @@ -103,7 +98,7 @@ scale_edge_width_manual <- function(
breaks = waiver(),
na.value = NA
) {
sc <- scale_size_manual(
sc <- scale_linewidth_manual(
...,
values = values,
breaks = breaks,
Expand All @@ -114,11 +109,11 @@ scale_edge_width_manual <- function(
}
#' @rdname scale_edge_width
#'
#' @inheritParams ggplot2::scale_size_identity
#' @inheritParams ggplot2::scale_linewidth_identity
#'
#' @export
scale_edge_width_identity <- function(..., guide = 'none') {
sc <- scale_size_identity(..., guide = guide)
sc <- scale_linewidth_identity(..., guide = guide)
sc$aesthetics <- 'edge_width'
sc
}
7 changes: 3 additions & 4 deletions man/geom_node_arc_bar.Rd

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

5 changes: 2 additions & 3 deletions man/geom_node_circle.Rd

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

4 changes: 2 additions & 2 deletions man/geom_node_range.Rd

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

10 changes: 4 additions & 6 deletions man/geom_node_tile.Rd

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

5 changes: 2 additions & 3 deletions man/geom_node_voronoi.Rd

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

56 changes: 39 additions & 17 deletions man/scale_edge_width.Rd

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

Loading