#--Read in data file: file <- "http://www.sr.bham.ac.uk/~ajrs/papers/sanderson09/sanderson09_table2.txt" a <- read.table(file, header=TRUE, sep="|") #--Specfify output graphics device: pdf(file="simple_dotplot.pdf", width=9, height=6) #--Load extra library for plotting: require(lattice) #--Change factor level names to be more informative: levels(a$cctype) <- c("Cool core", "Non-cool core") # cool core status levels(a$det) <- paste("ACIS", sep="-", levels(a$det)) # detector used #--Use "+" and filled square instead of "o" for plot symbols: trellis.par.set(superpose.symbol=list(pch=c(3,15))) #--Create custom character string comprising the cluster name with the # observation identifier in brackets: a$mystr <- with(a, paste(nedname, " (", obsid, ")", sep="")) #--Create dot plot with clusters ordered by increasing redshift: # NB "alternating=1" puts the X-axis labels on the bottom axes in all panels # "columns=2" creates side-by-side labels in the plot key (legend) dotplot(reorder(mystr, z) ~ z | det, data=a, groups=cctype, auto.key=list(columns=2), scale=list(alternating=1), xlab="Galaxy cluster redshift" ) #--Close plotting device: dev.off()