Closed
Description
This is a classic srcref
problem affecting readability when printing $constructor
to console
library(ggplot2)
p_expr <- parse(text = "
p <- ggplot() +
geom_point(size = 5)
")
eval(p_expr)
# Whole plot code displayed on print
p$layers[[1]]$constructor
#> p <- ggplot() +
#> geom_point(size = 5)
# Stripping srcref shows the actual layer code
attr(p$layers[[1]]$constructor, "srcref") <- NULL
p$layers[[1]]$constructor
#> geom_point(size = 5)
A simple fix would be to apply this one-liner where the constructor property is resolved in layer()
:
Line 183 in 7fb5760
Stripping the srcref of fr_call
above would naturally resolve one other case where this happens (in layer_sf()
, since it gets forwarded to layer()
)
Lines 25 to 28 in 7fb5760
If that seems reasonable, I can file a PR! :)
Metadata
Metadata
Assignees
Labels
No labels