/* Matt Martell IAT 800 - Dr. Christopher Shaw Due Oct. 20, 2008 Project 2 - Scatter Plot Graph */ void setup () { size (575,575); background (255,255,255); // Draw gridlines at half way marks and to frame strokeWeight (3); stroke ( 0, 0, 0); line (wAlt*1/2+m,0,wAlt*1/2+m,hAlt); line (m,hAlt*1/2,wAlt+m,hAlt*1/2); stroke (192,192,192); line(m,0,m,hAlt); line(m,hAlt,wAlt+m,hAlt); //Print the text descriptors PFont font; font = loadFont("Graph.vlw"); textFont(font); fill(0, 102, 153, 51); text("50", 45, hAlt*1/2+6); text("50", wAlt*1/2+m-7, hAlt+25); text("0", m-12, hAlt+20); fill(0, 102, 153, 85); text("rater X", wAlt*1/2+m-20, hAlt+45); rotate (-PI*1/2); text("rater Y", -275, hAlt*1/12); } //Variables // Define Averages to set bottom 25%, middle 50%, top 25% // Numbers comes from original excel file using rank cut off's float btmAvgX = .45; float btmAvgY = .40; float topAvgX = .65; float topAvgY = .65; // Definintion of variables to turn bottom, middle, top into boundary points float btmX; float btmY; float topX; float topY; // Color definitions color btmZone = color(255,0,0,50); // lower percentage (red) color midZone = color(255,204,0,30); // middle percentage (yellow) color topZone = color(0,255,0,25); // upper percentage (green) color btm = color (255,0,0); // red color mid = color(255,204,0); // yellow color top = color (0,255,0); // green // Define Variables for use in calling data from text file int n = 132; // n = number of lines in text file float xArr[] = new float[n] ; float yArr[] = new float[n] ; float colorArr[] = new float[n] ; // 1 = top, 2 = mid, 3 = btm // Define size of program area int m = 75; // size of margin for text and reference points int wAlt = 500; //width of graph int hAlt = 500; //height of graph int a = hAlt+m; int b = wAlt+m; void draw () { //Function to turn percentage into boundary points "m" adjusts for margin btmX = btmAvgX*wAlt+m; btmY = btmAvgY*hAlt-m; topX = topAvgX*wAlt+m; topY = topAvgY*hAlt-m; // Draw the boxes for zones of agreement stroke ( 40, 50, 200,5 ); fill (btmZone); rect (m,hAlt-btmY-m, btmX-m,btmY+m); fill (midZone); rect (btmX,hAlt-topY-m,topX-btmX,topY-btmY); fill (topZone); rect(topX,0,wAlt-topY-m,hAlt-topY-m); noLoop(); // Call information from text file (only pulling first 3 variables) average and // Code adapted from IAT 355 class example using some help from Allen float xArr[] = new float[n] ; String lines[] = loadStrings( "data.txt" ); for (int i=0; i < n && i < lines.length ; i++ ) { float[] numbers = float( split( lines[i], "," ) ); for( int j = 0 ; j < numbers.length ; j++ ) { if( j == 0 ) { xArr[i] = numbers[j] ; } if( j == 1 ) { yArr[i] = numbers[j] ; } if( j == 2 ) { colorArr[i] = numbers[j] ; } } } // Posting elipses to the spreadsheet stroke( 40, 50, 200,75 ); strokeWeight (1); for (int i=0; i