# # Fig4p1_PR_Book.r -- Makes Graph of Chamber and Party Means # From Common Space Coordinates # # # Remove all objects just to be safe # rm(list=ls(all=TRUE)) # T <- matrix(scan("C:/R_Files/both_means.dat",0),ncol=12,byrow=TRUE) # # par(mfrow=c(1,2)) # # year <- NULL nrow <- length(T[,1]) year <- 1787+2*T[,1] # # plot(year,T[,3], xlab="Year",ylab="Liberal-Conservative", main="House 1937-2002\n Chamber Mean and Party Means", ylim=c(-.6,.6), type="n",axes=FALSE) axis(1,year[1:33], labels=c( '1937', '1939', '1941', '1943', '1945', '1947', '1949', '1951', '1953', '1955', '1957', '1959', '1961', '1963', '1965', '1967', '1969', '1971', '1973', '1975', '1977', '1979', '1981', '1983', '1985', '1987', '1989', '1991', '1993', '1995', '1997', '1999', '2001')) # box() points(year,T[,3],pch=22,col="black") lines(year[1:nrow],T[1:nrow,3],lty=1,lwd=3,col="black") points(year,T[,6],pch=16,col="red") lines(year[1:nrow],T[1:nrow,6],lty=1,lwd=3,col="red") points(year,T[,7],pch=16,col="red4") lines(year[1:nrow],T[1:nrow,7],lty=1,lwd=3,col="red4") points(year,T[,5],pch=16,col="blue4") lines(year[1:nrow],T[1:nrow,5],lty=1,lwd=3,col="blue4") # # # Here is the Trick to get R to put in the coordinates # as specified in the "ylim" argument in Plot(...) above # # text(1951, .40,"Republicans",col="black") text(1951, .15,"Chamber",col="black") text(1979,-0.20,"S. Democrats",col="black") text(1951,-0.45,"N. Democrats",col="black") # axis(2) # plot(year,T[,3], xlab="Year",ylab="Liberal-Conservative", main="Senate 1937-2002\nChamber Mean and Party Means", ylim=c(-.6,.6), type="n",axes=FALSE) axis(1,year[1:33], labels=c( '1937', '1939', '1941', '1943', '1945', '1947', '1949', '1951', '1953', '1955', '1957', '1959', '1961', '1963', '1965', '1967', '1969', '1971', '1973', '1975', '1977', '1979', '1981', '1983', '1985', '1987', '1989', '1991', '1993', '1995', '1997', '1999', '2001')) # box() points(year,T[,8],pch=22,col="black") lines(year[1:nrow],T[1:nrow,8],lty=1,lwd=3,col="black") points(year,T[,11],pch=16,col="red") lines(year[1:nrow],T[1:nrow,11],lty=1,lwd=3,col="red") points(year,T[,12],pch=16,col="red4") lines(year[1:nrow],T[1:nrow,12],lty=1,lwd=3,col="red4") points(year,T[,10],pch=16,col="blue4") lines(year[1:nrow],T[1:nrow,10],lty=1,lwd=3,col="blue4") # # # Here is the Trick to get R to put in the coordinates # as specified in the "ylim" argument in Plot(...) above # # text(1951, .40,"Republicans",col="black") text(1951, .15,"Chamber",col="black") text(1979,-0.20,"S. Democrats",col="black") text(1951,-0.45,"N. Democrats",col="black") # axis(2)