December 2006
M T W T F S S
« Oct   Jan »
 123
45678910
11121314151617
18192021222324
25262728293031

Superimposing two plots

If you want to give two plot commands, and do not want the second one to wipe out the first one, do the following.

 

plot(first plot)

 

par(new=TRUE)

 

plot(second plot)

 

This will superimpose the second plot on the first. Note that the two plots may have different scales. To ensure that they use a particular (say, same) [...]

scatterplot.matrix

John Fox’s package, “car”, has a very useful scatterplot.matrix (or simply spm) to make scatterplots of pairs from a set of variables. The plot below was created using

library(“car”)
scatterplot.matrix(~Exppop+Exppphc+literacy+Oppphc, reg.line=lm, smooth=TRUE, span=0.5, diagonal = ‘density’, data=temp)
dev.print(jpeg, file=”~/graph-matrix.jpg”, width=500, [...]

jitter

jitter is an interesting function that adds a small noise to a vector. A very useful feature if you want to plot data points which have [...]