Description Usage Arguments Value References Examples
This function constructs a scatter plot using graphical elements: points, lines, images and labels. The order and position of these elements has been chosen for legibility, in particular the positioning of images down and to the right of the co-ordinate they represent.
| 1 2 3 4 5 6 7 | 
| x | The x co-ordinates at which to plot the elements (as per xy.coords() . Note that the names of the x and y axes are always taken from ..., not from xy.coords). | 
| y | The y co-ordinates at which to plot the elements (as per xy.coords() ). | 
| images | A list of raster images. | 
| labels | The labels for the x,y co-ordinates. | 
| main | The main title for the plot | 
| sub | The subtitle for the plot. | 
| xlim | A vector of the minimum and maximum x values for the axes. If NULL, calculated from x. | 
| ylim | A vector of the minimum and maximum y values for the axes. If NULL, calculated from y. | 
| axes | Whether to plot the axes or not. | 
| ann | Whether to annotate the plot or not. | 
| text.adj | The adj argument for text(). This can't be set in ... as we need to specify the two-argument vector version. | 
| thumbnailWidth | The width to standardize images to, in device independent pixels. | 
| ... | Other arguments to pass to the plotting functions. These can be used to set colour and other visual properties, and to set labels. | 
None.
Based on the documented behaviour of ImagePlot: http://lab.softwarestudies.com/p/imageplot.html
| 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | library(CulturalAnalytics)
library(jpeg)
# Utility code to transform file names into labels
stripExtension<-function(filename){
  sub("\\.[^.]+$", "", filename)
}
underscoresToSpaces<-function(source){
  gsub("_", " ", source)
}
cleanFilename<-function(filepath){
  filename<-basename(filepath)
  name<-stripExtension(filename)
  underscoresToSpaces(name)
}
# 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="catest.png", width=8, height=6, units="in", res=72)
# Set the background colour
par(bg="gray40")
# Draw the image scatter (and lines, points and labels)
# Note setting of graphics parameters using ...
imagePlot(vMedian, sMean, imgs, cleanFilename(dirimgs),
                 thumbnailWidth=72,
                 col="white", col.main="white", col.axis="white",
                 col.lab="white", cex=0.6, text.adj=c(0, -0.5),
                 main="imagePlot() Example",
                 xlab="Value Median", ylab="Saturation Median")
dev.off()
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.