Skip to content

Commit

Permalink
Added missing parameters to geom_textline
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanCameron committed Dec 22, 2021
1 parent a90f240 commit 3e5f054
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export(geom_textdensity)
export(geom_textdensity2d)
export(geom_textline)
export(geom_textpath)
export(geom_textsf)
export(geom_textsegment)
export(geom_textsf)
export(geom_textsmooth)
export(labelpathGrob)
export(stat_textcontour)
Expand All @@ -46,6 +46,7 @@ importFrom(stats,bw.nrd)
importFrom(stats,complete.cases)
importFrom(stats,dnorm)
importFrom(stats,setNames)
importFrom(stats,spline)
importFrom(systemfonts,glyph_info)
importFrom(textshaping,shape_text)
importFrom(utils,head)
Expand Down
26 changes: 21 additions & 5 deletions R/geom_textpath.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ GeomTextpath <- ggproto("GeomTextpath", Geom,
#' @rdname geom_textpath
geom_textline <- function(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, orientation = NA,
show.legend = NA, inherit.aes = TRUE, ...) {
show.legend = NA, inherit.aes = TRUE, ...,
lineend = "butt", linejoin = "round", linemitre = 10,
text_only = FALSE, gap = NA, upright = TRUE,
halign = "center", offset = NULL, parse = FALSE,
straight = FALSE, padding = unit(0.15, "inch"),
arrow = NULL) {
layer(
data = data,
mapping = mapping,
Expand All @@ -271,10 +276,21 @@ geom_textline <- function(mapping = NULL, data = NULL, stat = "identity",
show.legend = show.legend,
inherit.aes = inherit.aes,
params = set_params(
na.rm = na.rm,
orientation = orientation,
...
)
na.rm = na.rm,
lineend = lineend,
linejoin = linejoin,
linemitre = linemitre,
text_only = text_only,
gap = gap,
upright = upright,
halign = halign,
offset = offset,
parse = parse,
straight = straight,
padding = padding,
arrow = arrow,
...
)
)
}

Expand Down
1 change: 1 addition & 0 deletions R/geomtextpath-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#' @import ggplot2
#' @import grid
#' @importFrom stats approx dnorm approxfun complete.cases ave bw.nrd setNames
#' spline
#' @importFrom utils head tail
#' @importFrom graphics strwidth
#' @importFrom systemfonts glyph_info
Expand Down
2 changes: 1 addition & 1 deletion R/trig_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ corner_smoother <- function(x0, y0, x1, y1, x2, y2, p = 20) {
find_control_points <- function(x, y, radius = 0.5) {

lens <- diff(.arclength_from_xy(x, y))
angs <- .angle_from_xy(x, y)
angs <- atan2(diff(y), diff(x))

segs <- Map(function(x, y, len, ang) {

Expand Down
14 changes: 13 additions & 1 deletion man/geom_textpath.Rd

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

1 comment on commit 3e5f054

@teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented on 3e5f054 Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Alan, we don't need to explicitly define these static text parameters if they have default values: they are automatically picked up from ... in the set_params() function. I've included this in #43 to not have to bother with these as much and keep the function formals cleaner. They should also automagically appear in the documentation without having to think about them too much (was included in #44).

Please sign in to comment.