Skip to content

Commit e11b89c

Browse files
committed
require z attr in heatmaps
1 parent 9bcee73 commit e11b89c

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

R/add.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,7 @@ add_heatmap <- function(p, x = NULL, y = NULL, z = NULL, ...,
409409
z <- z %||% p$x$attrs[[1]][["z"]]
410410
}
411411
if (is.null(z)) {
412-
if (is.null(x) || is.null(y)) {
413-
stop("Must supply both `x` and `y` attributes if `z` is NULL", call. = FALSE)
414-
}
412+
stop("Must supply `z` attribute", call. = FALSE)
415413
}
416414
add_trace_classed(
417415
p, class = "plotly_heatmap", z = z,

R/plotly_build.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ map_color <- function(traces, title = "", na.color = "transparent") {
441441
# we need some way to identify pre-specified defaults in subplot to retrain them
442442
if (is.null(color[[i]])) attr(rgb, "defaultAlpha") <- alpha
443443
obj <- if (hasLine[[i]]) "line" else if (hasMarker[[i]]) "marker" else if (hasText[[i]]) "textfont"
444+
if (is.null(obj)) next
444445
traces[[i]][[obj]] <- modify_list(list(color = rgb), traces[[i]][[obj]])
445446
traces[[i]][[obj]] <- modify_list(list(fillcolor = rgb), traces[[i]][[obj]])
446447
}

0 commit comments

Comments
 (0)