require(ggplot2)
data("sketches_train")
x <- sketches_train[sample(1:nrow(sketches_train), 1), ]
# print(x$word)
xm <- data.frame(gry=t(as.matrix(x[,1:784])),
x=rep(1:28, 28),
y=rep(28:1, rep(28, 28)))
ggplot(xm, aes(x=x, y=y, fill=gry)) +
geom_tile() +
scale_fill_gradientn(colors = gray.colors(256, start = 0, end = 1, rev = TRUE )) +
theme_void() + theme(legend.position="none")
Run the code above in your browser using DataLab