Skip to content

Commit 3f0b0bd

Browse files
committed
don't try to bump xref/yref if there are no annotations
1 parent 4caa068 commit 3f0b0bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

R/subplots.R

+2
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ subplot <- function(..., nrows = 1, widths = NULL, heights = NULL, margin = 0.02
214214
axisMap <- setNames(sub("axis", "", axisMap), sub("axis", "", names(axisMap)))
215215
newAnchors <- names(axisMap)[match(oldAnchors, axisMap)]
216216
traces[[i]] <- Map(function(tr, a) { tr[[key]] <- a; tr }, traces[[i]], newAnchors)
217+
# also map annotation[i].xref/annotation[i].yref
217218
annAnchor <- list(xaxis = "xref", yaxis = "yref")[[key]]
218219
if (is.null(annAnchor)) next
220+
if (is.null(annotations[[i]])) next
219221
annotations[[i]] <- Map(function(ann, a) { ann[[annAnchor]] <- a; ann}, annotations[[i]], newAnchors)
220222
}
221223

0 commit comments

Comments
 (0)