I'm working with an historical image that may be (one of?) the first uses of gray-scale shading to show the pattern of values in a matrix/table, later used by Bertin in his 'reorderable matrix' and sometimes called a scalogram. The image is at http://euclid.psych.yorku.ca/SCS/Gallery/images/Private/scalogram.jpg The rows refer to the arrondisements of Paris, the cols to various population characteristics. I want to read it into R with rimage(read.jpeg), calcualte avg. shading values, and recreate an approximation to the image with the row and column labels. I'm stuck at this last step, plot(imagematrix(mat)) (and also on how to read the image from a URL). Can someone help? My code is below library(rimage) image <- read.jpeg("C:/Documents/milestone/images/scalogram.jpg") ## how to read from web? #image <- read.jpeg("http://euclid.psych.yorku.ca/SCS/Gallery/images/Private/scalogram.jpg") # remove row/col headers img2 <- image[480:1740, 470:2350] str(img2) # size of each blob ht <-floor(nrow(img2)/20); wd <-floor(ncol(img2)/40) # calculate trimmed mean of pixel values mat <- matrix(nrow=20,ncol=40,0) for (i in 1:20) { for (j in 1:40) { rows <- seq(1+(i-1)*ht, i*ht) cols <- seq(1+(j-1)*wd, j*wd) blob <- img2[ rows, cols ] mat[i,j] <- mean(blob, trim=0.1) } } # names for arrrondisements rnames <- c( "01 Louvre", "02 Bourse", "03 Temple", "04 Hotel de Ville", "05 Pantheon", "06 Luxembourg", "07 Palais", "08 Eglise", "09 Opera", "10 St. Laurent", "11 Popincourt", "12 Reuilly", "13 Goeblins", "14 Observatoire", "15 Vaurigard", "16 Passy", "17 Batingnoles", "18 Montmartre", "19 B. Chaumont", "20 Menilmontant") #names for population characteristics cnames <- c("01 Accrois. pop", "02 Pop specifique", "03 Habitants/menage", "04 Maisons/hectare", "05 Habitants/maison", "06 Appart./maison", "07 Appart. vacantes", "08 Locaux Indust.&C", "09 Garnisson,", "10 Parisiens", "11 Provinseaux", "12 Etrangers", "13 Calvinistes", "14 Lutheriens", "15 Isrealites", "16 Libres penseurs", "17 Illettres", "18 Enfants", "19 Mineurs", "20 Adultes", "21 Vieillards", "22 Electeurs", "23 Horticulture", "24 Industrie", "25 Commerce", "26 Transports", "27 Prof. diverses", "28 Prof. liberales", "29 Forces publiques", "30 Admin. publique", "31 Clerge", "32 Proprietaires rentiers", "33 Pop. aisee", "34 Employees", "35 Ouvriers", "36 Journaliers", "37 Domestiques", "38 Chevaux", "39 Chiens", "40 Moralite" ) dimnames(mat) <- list(rnames, cnames) # how to plot the image matrix with row/col names??? # show the image matrix plot(imagematrix(mat)) -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA