Skip to content

Commit

Permalink
Fix #301 + use list2 when collecting params
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Jan 11, 2024
1 parent f2ce8c7 commit 4353f24
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 86 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Fix a bug with auto layout on undirected trees (#247)
* Fix a bug in `get_con()` that would lead to wrong matching of additional data
(#249)
* Allow `na.rm` in geoms (#301)

# ggraph 2.1.0

Expand Down
2 changes: 1 addition & 1 deletion R/geom_axis_hive.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@ geom_axis_hive <- function(mapping = NULL, data = NULL,
data = data, mapping = mapping, stat = StatAxisHive,
geom = GeomAxisHive, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = list(na.rm = FALSE, label = label, axis = axis, ...)
params = list2(label = label, axis = axis, ...)
)
}
16 changes: 8 additions & 8 deletions R/geom_conn_bundle.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ geom_conn_bundle <- function(mapping = NULL, data = get_con(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE, n = n,
interpolate = FALSE, tension = tension, type = 'clamped', ...
list2(
arrow = arrow, lineend = lineend, n = n, interpolate = FALSE,
tension = tension, type = 'clamped', ...
)
)
)
Expand Down Expand Up @@ -162,8 +162,8 @@ geom_conn_bundle2 <- function(mapping = NULL, data = get_con(),
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE, n = n,
interpolate = TRUE, tension = tension, type = 'clamped', ...
arrow = arrow, lineend = lineend, n = n, interpolate = TRUE,
tension = tension, type = 'clamped', ...
)
)
)
Expand Down Expand Up @@ -198,9 +198,9 @@ geom_conn_bundle0 <- function(mapping = NULL, data = get_con(),
geom = GeomEdgeBspline, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE,
tension = tension, type = 'clamped', ...
list2(
arrow = arrow, lineend = lineend, tension = tension, type = 'clamped',
...
)
)
)
Expand Down
13 changes: 6 additions & 7 deletions R/geom_edge_arc.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ geom_edge_arc <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = FALSE, strength = strength, fold = fold,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -207,9 +207,9 @@ geom_edge_arc2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = TRUE, strength = strength, fold = fold,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -252,9 +252,8 @@ geom_edge_arc0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeBezier, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE,
strength = strength, fold = FALSE, ...
list2(
arrow = arrow, lineend = lineend, strength = strength, fold = FALSE, ...
)
)
)
Expand Down
12 changes: 6 additions & 6 deletions R/geom_edge_bend.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ geom_edge_bend <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = FALSE, flipped = flipped, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -181,9 +181,9 @@ geom_edge_bend2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = TRUE, flipped = flipped, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -223,8 +223,8 @@ geom_edge_bend0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeBezier, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE, strength = strength,
list2(
arrow = arrow, lineend = lineend, strength = strength,
flipped = flipped, ...
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/geom_edge_density.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ geom_edge_density <- function(mapping = NULL, data = get_edges('short'),
geom = GeomEdgeDensity, position = position,
show.legend = show.legend, inherit.aes = FALSE,
params = expand_edge_aes(
list(na.rm = FALSE, n = n, ...)
list2(n = n, ...)
)
)
}
12 changes: 6 additions & 6 deletions R/geom_edge_diagonal.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ geom_edge_diagonal <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = FALSE, flipped = flipped, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -189,9 +189,9 @@ geom_edge_diagonal2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = TRUE, flipped = flipped, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -231,8 +231,8 @@ geom_edge_diagonal0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeBezier, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE, strength = strength,
list2(
arrow = arrow, lineend = lineend, strength = strength,
flipped = flipped, ...
)
)
Expand Down
14 changes: 7 additions & 7 deletions R/geom_edge_elbow.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ geom_edge_elbow <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = FALSE, flipped = flipped, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -300,9 +300,9 @@ geom_edge_elbow2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = TRUE, flipped = flipped, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -404,9 +404,9 @@ geom_edge_elbow0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE,
interpolate = FALSE, flipped = flipped, ...
list2(
arrow = arrow, lineend = lineend, interpolate = FALSE, flipped = flipped,
...
)
)
)
Expand Down
13 changes: 6 additions & 7 deletions R/geom_edge_fan.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ geom_edge_fan <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = FALSE, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -199,9 +199,9 @@ geom_edge_fan2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = TRUE, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -244,9 +244,8 @@ geom_edge_fan0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeBezier, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE,
strength = strength, ...
list2(
arrow = arrow, lineend = lineend, strength = strength, ...
)
)
)
Expand Down
13 changes: 6 additions & 7 deletions R/geom_edge_hive.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ geom_edge_hive <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = FALSE, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -200,9 +200,9 @@ geom_edge_hive2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
linemitre = linemitre, n = n,
interpolate = TRUE, strength = strength,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
Expand Down Expand Up @@ -243,9 +243,8 @@ geom_edge_hive0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeBezier, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE,
strength = strength, ...
list2(
arrow = arrow, lineend = lineend, strength = strength, ...
)
)
)
Expand Down
12 changes: 5 additions & 7 deletions R/geom_edge_link.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,9 @@ geom_edge_link <- function(mapping = NULL, data = get_edges('short'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
interpolate = FALSE,
linemitre = linemitre, n = n, interpolate = FALSE,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
angle_calc = angle_calc, force_flip = force_flip,
Expand Down Expand Up @@ -233,10 +232,9 @@ geom_edge_link2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
interpolate = TRUE,
linemitre = linemitre, n = n, interpolate = TRUE,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
angle_calc = angle_calc, force_flip = force_flip,
Expand All @@ -260,7 +258,7 @@ geom_edge_link0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeSegment, position = position,
show.legend = show.legend, inherit.aes = FALSE,
params = expand_edge_aes(
list(arrow = arrow, lineend = lineend, na.rm = FALSE, ...)
list2(arrow = arrow, lineend = lineend, ...)
)
)
}
7 changes: 3 additions & 4 deletions R/geom_edge_loop.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ geom_edge_loop <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgePath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
list2(
arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, n = n,
interpolate = FALSE,
linemitre = linemitre, n = n, interpolate = FALSE,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
angle_calc = angle_calc, force_flip = force_flip,
Expand Down Expand Up @@ -157,7 +156,7 @@ geom_edge_loop0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeBezier, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(arrow = arrow, lineend = lineend, na.rm = FALSE, ...)
list2(arrow = arrow, lineend = lineend, ...)
)
)
}
Expand Down
15 changes: 6 additions & 9 deletions R/geom_edge_parallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ geom_edge_parallel <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeParallelPath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, sep = sep, n = n,
interpolate = FALSE,
list2(arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, sep = sep, n = n, interpolate = FALSE,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
angle_calc = angle_calc, force_flip = force_flip,
Expand Down Expand Up @@ -187,9 +186,8 @@ geom_edge_parallel2 <- function(mapping = NULL, data = get_edges('long'),
geom = GeomEdgeParallelPath, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, na.rm = FALSE, sep = sep, n = n,
interpolate = TRUE,
list2(arrow = arrow, lineend = lineend, linejoin = linejoin,
linemitre = linemitre, sep = sep, n = n, interpolate = TRUE,
label_colour = label_colour, label_alpha = label_alpha,
label_parse = label_parse, check_overlap = check_overlap,
angle_calc = angle_calc, force_flip = force_flip,
Expand Down Expand Up @@ -226,9 +224,8 @@ geom_edge_parallel0 <- function(mapping = NULL, data = get_edges(),
geom = GeomEdgeParallelSegment, position = position, show.legend = show.legend,
inherit.aes = FALSE,
params = expand_edge_aes(
list(
arrow = arrow, lineend = lineend, na.rm = FALSE,
sep = sep, ...
list2(
arrow = arrow, lineend = lineend, sep = sep, ...
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/geom_edge_point.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ geom_edge_point <- function(mapping = NULL, data = get_edges(),
layer(
data = data, mapping = mapping, stat = StatFilter, geom = GeomEdgePoint,
position = position, show.legend = show.legend, inherit.aes = FALSE,
params = list(na.rm = FALSE, mirror = mirror, ...)
params = list2(mirror = mirror, ...)
)
}
Loading

0 comments on commit 4353f24

Please sign in to comment.