I am trying to create an interactive map of Europe using irregular gridded orography data (Irregular grid means that lon-lat are not constant throughout each line-column of the matrix). So I thought I can use the heatmap function 3 times. The first 2 will display as hoverinfo the actual lat and lon of each grid, and the 3rd layer will be the orography.
I am recreating below a simple example. The first 2 layers of heatmap are working flawlessly, but when I add the last line I receive the error display below.
### Create data lon <- matrix(rnorm(100), nrow=10, ncol=10) lat <- matrix(rnorm(100), nrow=10, ncol=10) orog <- matrix(rnorm(100, mean=1000), nrow=10, ncol=10) ### Plot plot_ly(z=t(lon), type = "heatmap", hoverinfo=c("z")) %>% add_trace(z=t(lat), hoverinfo=c("z")) %>% add_trace(z=t(orog))
Error in p$x$data[[idx]]$marker :
$ operator is invalid for atomic vectors
Any tip would be really helpful. Thanks!