# # Color_Circle.r -- Displays output from Optimization_Machine_MDS.c # # Remove all objects just to be safe # rm(list=ls(all=TRUE)) # # Reads in output from old Scaling Program and produces # Simple Graphs # # 0 63 8.445645 0.598626 0.717361 1.239282 1.309920 1.351527 1.157769 0.814434 0.559278 -0.348190 -0.631040 -0.758179 -0.742020 -0.681251 -0.613748 -1.139370 -1.067132 -0.675116 -0.518957 0.132401 0.670414 0.992630 1.098121 0.869959 0.438865 0.016973 -0.311668 -0.495218 -0.720792 # rc.file <- "c:/docs_c_summer_course/data_optim_3.txt" # # Standard fields and their widths for *.ORD files # rc.fields <- c("number","number2","sse","x11","x21","x31","x41","x51","x61","x71","x81","x91","x101","x111","x121","x131","x141", "x12","x22","x32","x42","x52","x62","x72","x82","x92","x102","x112","x122","x132","x142") # rc.fieldWidths <- c(5,6,16,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12) # # Read the Legislator Coordinates # T <- read.fwf(file=rc.file,widths=rc.fieldWidths,as.is=TRUE,col.names=rc.fields) #dim(T) T <- as.matrix(T) x1 <- rep(0,14) x1 <- c(14,1) x2 <- rep(0,14) x2 <- c(14,1) x1 <- T[1,4:17] x2 <- T[1,18:31] ymax1 <- max(x1) ymax2 <- max(x2) ymax <- 1.1*max(ymax1,ymax2) # plot(x1[1:14],x2[1:14],xlab="",ylab="",asp=1, main="", xlim=c(-ymax,ymax),ylim=c(-ymax,ymax),font=2) points(x1,x2,pch=16,col="blue",font=2,cex=1.1) # # Main title mtext("The Color Circle",side=3,line=1.50,cex=1.2,font=2) # x-axis title mtext(" X ",side=1,line=2.75,cex=1.2) # y-axis title mtext(" Y ",side=2,line=2.5,cex=1.2) # names <- NULL names[1] <- " 434" # INDIGO names[2] <- " 445" # BLUE names[3] <- " 465" # names[4] <- " 472" # BLUE-GREEN names[5] <- " 490" # names[6] <- " 504" # GREEN names[7] <- " 537" # names[8] <- " 555" # YELLOW-GREEN names[9] <- " 584" # names[10] <- " 600" # YELLOW names[11] <- " 610" # names[12] <- " 628" # ORANGE-YELLOW names[13] <- " 651" # ORANGE names[14] <- " 674" # RED # # pos -- a position specifier for the text. Values of 1, 2, 3 and 4, # respectively indicate positions below, to the left of, above and # to the right of the specified coordinates # namepos <- rep(2,14) # #namepos[1] <- 2 # 434 #namepos[2] <- 2 # 445 #namepos[3] <- 2 # 465 #namepos[4] <- 2 # 472 #namepos[5] <- 2 # 490 #namepos[6] <- 2 # 504 #namepos[7] <- 2 # 537 #namepos[8] <- 2 # 555 #namepos[9] <- 2 # 584 #namepos[10] <- 2 # 600 #namepos[11] <- 2 # 610 #namepos[12] <- 2 # 628 #namepos[13] <- 2 # 651 #namepos[14] <- 2 # 674 # text(x1,x2,names,pos=namepos,offset=00.25,col="red",font=2) # text(-ymax+.6,ymax,"Wavelength in Angstroms\n (one ten-millionth of a millimeter)",col="purple",font=2)