This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| # Per generar unes dades de prova... | |
| f <- function(x,y){ | |
| return(x^2 + y^2) | |
| } | |
| g <- expand.grid(x = seq(0,5), y = seq(0,5)) | |
| # Data frame en què totes les variables són numèriques | |
| A <- data.frame(x = g$x,y = g$y,z = f(g$x,g$y)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| g <- expand.grid(x = seq(0,5), y = seq(0,5)) | |
| # Fem un data.frame de prova | |
| A <- data.frame(x = g$x,y = g$y,z = rnorm(36)) | |
| # Cap problema per dibuixar-los | |
| pA <- ggplot(A, aes(x,y, z = z)) | |
| pA + geom_tile(aes(fill = z)) + |