I have some working R code that generates a tag cloud from a term-document matrix.
Now I want to create a whole bunch of tag clouds from many documents, and to inspect
One idea is to import the images , and save again them using grid.raster
, and add the titile using grid.text
. For example:
ll <- list.files(patt='*.png')
library(png)
library(grid)
imgs <- lapply(ll,function(x){
img <- as.raster(readPNG(x))
## get the file name
x.name <- gsub('(.*).png','\\1',x)
## new device for new image version
png(file =paste(x.name,'_modified','.png',sep=''))
grid.raster(img)
## here I add title
grid.text(label = x.name,x=0.5,y=0.9,gp=gpar(cex=2))
dev.off()
})