R language draws smooth heat map

# library
library(latticeExtra) 

# create data
set.seed(1) 
data <- data.frame(x = rnorm(100), y = rnorm(100)) 
data$z <- with(data, x * y + rnorm(100, sd = 1)) 

# showing data points on the same color scale 
levelplot(z ~ x * y, data, 
          panel = panel.levelplot.points, cex = 1.2
) + 
  layer_(panel.2dsmoother(..., n = 200))

insert image description here
References: https://blog.csdn.net/weixin_46587777/article/details/124973766
Development tools: RStudio 2023.06.1 Build 524
WeChat Alt+A screenshot tool

Guess you like

Origin blog.csdn.net/m0_38127487/article/details/131818592