Exercise from last week
	dat <- read.table(
		'http://www.mpimg-berlin-dahlem.mpg.de/~rodent/ttable1',
		fill=T, header=T, as.is=T
	)
	str(dat)
	dat[dat$C57BL.6 != dat$C3H,]
	dat[dat$C57BL.6 != dat$C3H,c(1,10,13)]
R is good for graphics
	demo(graphics)
	demo(persp)
	library(lattice)
	demo(lattice)
	browseURL("http://addictedtor.free.fr/graphiques/")
R magic
	R also has access to powerful graphics libraries like OpenGL:
	library(rgl)
	magic<-read.delim(
		"http://rcourse.iop.kcl.ac.uk/S4/magic.tsv"
	)
	open3d(
		bg=list(color='grey20',lit=FALSE,line=TRUE,fogtype="linear"),
		windowRect=c(100,100,600,600)
	)
	view3d(zoom=0.9)
	points3d(magic,col='white',fog=TRUE,size=8,point_antialias=TRUE)
plot() is good for statistical plotting
	it knows about data and factors
	it understands the formula interface
	it has methods for many specialised data objects
		histograms, kernel density plots 
	it makes reasonable guesses for format details
plotting math functions is also convenient
	curve(sin,from=0, to=10, n=101)
	curve(sqrt(1-x^2),from=0,to=1) # quarter of a unit circle
	curve(sqrt(1-x^2),from=-1,to=1) # half of a unit circle
	text(0.2,0.2,expression(y==1-x^2)) # nice-looking math
		see ?plotmath
possibly your program of choice for general graphics
	input is a problem with traditional drawing programs
	this is particularly true when there is data involved
		maps, timelines other diagrams
	format conversion and paste ups 
	changing data can mean repetitive editing
	alternatives: postscript, matlab, gnuplot, R
properties of R as a general graphics tool
	you can set up a canvas (panel) with arbitrary coordinates
	text, points, lines, curves, polygons, images ...
	multiple canvases can be put together
		par(mfrow=c(5,2))
		layout() 
		split.screen()
		lattice() # =Trellis
properties of a canvas (defaults)
	it has a little extra space beyond the limits
		par('plt')
	you can choose not to clip at the limits
		par('xpd')
	it has margins where axes and labels can go
		par('mar')
	it has an outer margin
		par('oma')
example: graph paper
	plot.new()
	plot.window(c(0,100),c(100,0))
	abline(v=0:100,col='grey90')
	abline(h=0:100,col='grey90')
	abline(h=0:20*5)
	abline(v=0:20*5)
	box()
	mtext('graph paper', line=1)
example: plot a chromosome map (data)
	markers     <- c( 72240103,99548034,124256128, 136988550,137926598)
	markernames <- c('Ntrk3'  ,'Cckbr' ,'BB220625','H19'    ,'Nap1l4' )
	markers     <- markers/1e6
	begins      <- 75; ends  <-  130
	maplength   <- 139
	adj         <- c(0,0,0,-3,3)
example: plot a chromosome map (plotting)
	plot.new()
	plot.window(c(0,10),c(maplength,0))
	rect(4.9,begins,5.1,ends,col='grey75')  # roi
	lines(c(5,5),c(0,maplength))            # chromosome
	points(5,0,cex=3,pch=16)                # centromere
	text(4.8,markers+ adj,markernames,adj=1,cex=0.9) # names
	points(cbind(5,markers),pch=3)          # marker ticks
example: mouse chromosome 17 SNPS
	uses layout() to make 6 panels
	uses plot.dendrogram to show clustering
	the rest is all done with lines() and text()
exercise: association plots
	See this week's script
	Bitmap graphics: 
	Vector graphics: PDF, SVG