img <- matrix(1:16, 4, 4)
image(img)
ggimage(t(img[,4:1]), fullpage = FALSE, scale_axes = TRUE)
ggimage(t(img[,4:1]), fullpage = FALSE)
if (FALSE) {
# not run due to slow performance
data(hadley)
ggimage(hadley)
ggimage(hadley, coord_equal = FALSE)
x <- seq(1, 438, 15); n <- length(x)
df <- data.frame(x = x, y = -(120*(scale((x - 219)^3 - 25000*x) + rnorm(n)/2 - 3)))
qplot(x, y, data = df, geom = c('smooth','point'))
ggimage(hadley, fullpage = FALSE) +
geom_smooth(
aes(x = x, y = y),
data = df, color = 'green', size = 1
) +
geom_point(
aes(x = x, y = y),
data = df, color = 'green', size = 3
)
}
Run the code above in your browser using DataLab