Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created December 6, 2024 07:13
Show Gist options
  • Save abikoushi/d6d89028cc01170d08db3ddb1967e326 to your computer and use it in GitHub Desktop.
Save abikoushi/d6d89028cc01170d08db3ddb1967e326 to your computer and use it in GitHub Desktop.
base's `persp` and `contour` example
x = seq(-4,4,length.out=100)
y = seq(-4,4,length.out=100)
df <- expand.grid(x = x, y = y)
prob <- matrix(pnorm(df$x)*pnorm(df$y), 100, 100)
#png("persp.png")
persp(x = x, y = y, z = prob, theta = 20, phi=45)
#dev.off()
#png("contour.png")
contour(x = x, y = y, z = prob)
#dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment