Overlay two heatmaps

I have two matrices, A and B, I want to make 2 heatmaps with plotly, and overlay them

library(plotly)
A = matrix(c(1:8, rep(0, 8)), ncol = 4)
B = matrix(c(rep(0, 8), 1:8), ncol = 4)

PA <- plot_ly(z = A, type = “heatmap”, colors = colorRamp(c(“white”, “green”)))
PB <- plot_ly(z = B, type = “heatmap”, colors = colorRamp(c(“white”, “red”)))

When I try to overlay them, they are indeed overplayed, but the second heatmap totally masked the first one.

PA %>% add_trace(z = B, type = “heatmap”)

I could change the opacity in order to ‘see’ both heatmaps

PA %>% add_trace(z = B, opacity = 0.5, type = “heatmap”)

But it is really not beautiful, and I cannot set different colours for each heatmap.

Are their some elegant way to overlay them? thanks a lot.