Description Usage Arguments Value Examples
The image scatter plot function used by imagePlot, made public so it can be used in plots created using other systems.
1 |
x |
The x co-ordinates at which to plot the elements (as per xy.coords() ). |
y |
The y co-ordinates at which to plot the elements (as per xy.coords() ). |
images |
A list of raster images. |
thumbnailWidth |
The width to standardize images to, in device independent pixels. |
cex |
The factor to scale each image by. For images of different aspect ratios, the results may be difficult to compare visually. |
None.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | library(CulturalAnalytics)
library(jpeg)
# Get the images
imgdir<-paste(system.file(package = "CulturalAnalytics"), "images", sep = "/")
dirimgs<-paste(imgdir, dir(path = imgdir, pattern = ".jpg"), sep = "/")
imgs<-lapply(dirimgs, function(imgpath){readJPEG(imgpath)})
# Get the image property summaries
summaries<-lapply(imgs,
function(img){rgbs<-imageToRgb(img)
hsvs<-rgbToHsv(rgbs)
summaryHsv(hsvs)})
vMedian<-as.numeric(lapply(summaries, function(summary){summary$V[["Median"]]}))
sMean<-as.numeric(lapply(summaries,
function(summary){summary$S[["Mean"]]}))
# Start drawing to file
png(filename="images-test.png", width=6, height=6, units="in", res=72)
plot.new()
# Set the background colour
par(bg="gray40")
# Draw the image scatter (and lines, points and labels)
# Note setting of graphics parameters using ...
images(vMedian, sMean, imgs)
dev.off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.