[R] barplot & plot together

juli g. pausas juli at ceam.es
Thu Dec 18 10:54:08 CET 2003


Dear colleges,
I'm trying to combine a barplot and a plot in a single figure as follows:

data <- 1:6
t <- barplot(data, axes=F)
par(new= T)
plot(t, data, type="b")

However, as you can see in the example, the dots of the second plot do 
not fall in the midpoint of the bars in the first. Any trick for setting 
the 2 plots at the same scale?
I have unsuccessfully tried:
plot(t, data, type="b", xlim=c(0,7))
plot(t, data, type="b", xlim=c(min(t),max(t)))

(R 1.8.1, for Windows)

Thanks

Juli



-- 
Juli G. Pausas
Centro de Estudios Ambientales del Mediterraneo (CEAM)
C/ Charles R. Darwin 14, Parc Tecnologic,
46980 Paterna, Valencia, SPAIN
Tel: (+ 34) 96 131 8227; Fax: (+ 34) 96 131 8190
mailto:juli at ceam.es
http://www.gva.es/ceam

GCTE Fire Network - http://www.gva.es/ceam/FireNetwork




More information about the R-help mailing list