Skip to content

Commit 2e19e36

Browse files
committed
don't change paper references
1 parent 3f0b0bd commit 2e19e36

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

R/subplots.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,13 @@ subplot <- function(..., nrows = 1, widths = NULL, heights = NULL, margin = 0.02
215215
newAnchors <- names(axisMap)[match(oldAnchors, axisMap)]
216216
traces[[i]] <- Map(function(tr, a) { tr[[key]] <- a; tr }, traces[[i]], newAnchors)
217217
# also map annotation[i].xref/annotation[i].yref
218-
annAnchor <- list(xaxis = "xref", yaxis = "yref")[[key]]
219-
if (is.null(annAnchor)) next
218+
ref <- list(xaxis = "xref", yaxis = "yref")[[key]]
219+
if (is.null(ref)) next
220220
if (is.null(annotations[[i]])) next
221-
annotations[[i]] <- Map(function(ann, a) { ann[[annAnchor]] <- a; ann}, annotations[[i]], newAnchors)
221+
annotations[[i]] <- Map(function(ann, a) {
222+
if (!identical(ann[[ref]], "paper")) ann[[ref]] <- a
223+
ann
224+
}, annotations[[i]], newAnchors)
222225
}
223226

224227
# rescale domains according to the tabular layout

0 commit comments

Comments
 (0)