Skip to content

Commit d1db211

Browse files
committed
geom_abline()'s intercept/slope moved from params to data
1 parent b395eb4 commit d1db211

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/trace_generation.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ layer2traces <- function(l, d, misc) {
1010
to.exclude <- apply(na.mat, 1, any)
1111
df[!to.exclude, ]
1212
}
13+
1314
g <- list(
1415
geom = type(l, "geom"),
1516
data = not.na(d),
1617
prestats.data = not.na(l$prestats.data)
1718
)
18-
19+
#if (grepl("line", g$geom)) browser()
1920
# needed for when group, etc. is an expression.
2021
g$aes <- sapply(l$mapping, function(k) as.character(as.expression(k)))
2122
# Partial conversion for geom_violin (Plotly does not offer KDE yet)
@@ -677,8 +678,8 @@ geom2trace <- list(
677678
},
678679
abline=function(data, params) {
679680
list(x=c(params$xstart, params$xend),
680-
y=c(params$intercept + params$xstart * params$slope,
681-
params$intercept + params$xend * params$slope),
681+
y=c(data$intercept + params$xstart * data$slope,
682+
data$intercept + params$xend * data$slope),
682683
name=params$name,
683684
type="scatter",
684685
mode="lines",

0 commit comments

Comments
 (0)