#include #include #include #include #include void plotLine(const float slope, const float intercept) { float x1, x2, y1, y2; cpgqwin(&x1,&x2,&y1,&y2); cpgmove(x1,slope*x1+intercept); cpgdraw(x2,slope*x2+intercept); } void lineOfEquality() { plotLine(1.,0.); } void lineOfBestFit(int size, float *x, float *y) { float a,b,r,erra,errb; linear_regression(size,x,y,0,size-1,a,erra,b,errb,r); plotLine(a,b); } void plotVertLine(const float xval, const int colour, const int style) { float x1, x2, y1, y2; cpgqwin(&x1,&x2,&y1,&y2); int currentColour,currentStyle; cpgqci(¤tColour); cpgqls(¤tStyle); if(currentColour!=colour) cpgsci(colour); if(currentStyle !=style) cpgsls(style); cpgmove(xval,y1); cpgdraw(xval,y2); if(currentColour!=colour) cpgsci(currentColour); if(currentStyle !=style) cpgsls(currentStyle); } void plotVertLine(const float xval) { int colour,style; cpgqci(&colour); cpgqls(&style); plotVertLine(xval,colour,style); } void plotVertLine(const float xval, const int colour) { int style; cpgqls(&style); plotVertLine(xval,colour,style); } void plotHorizLine(const float yval, const int colour, const int style) { float x1, x2, y1, y2; cpgqwin(&x1,&x2,&y1,&y2); int currentColour,currentStyle; cpgqci(¤tColour); cpgqls(¤tStyle); if(currentColour!=colour) cpgsci(colour); if(currentStyle !=style) cpgsls(style); cpgmove(x1,yval); cpgdraw(x2,yval); if(currentColour!=colour) cpgsci(currentColour); if(currentStyle !=style) cpgsls(currentStyle); } void plotHorizLine(const float yval) { int colour,style; cpgqci(&colour); cpgqls(&style); plotHorizLine(yval,colour,style); } void plotHorizLine(const float yval, const int colour) { int style; cpgqls(&style); plotHorizLine(yval,colour,style); } void lineOfBestFitPB(const int size, const float *x, const float *y) { int numSim = int(size * log(float(size)*log(float(size))) ); float slope=0, intercept=0; float *xboot = new float[size]; float *yboot = new float[size]; for(int sim=0;sim= (nbin*nbin)) duchampError("drawContours","pixel position out of range"); binnedarray[ypos*nbin+xpos] += 1.; } float maxct = binnedarray[0]; for(int i=1;imaxct) maxct=binnedarray[i]; float tr[6]={x1-3*xbin/2,xbin,0.,y1-3*ybin/2,0.,ybin}; const int ncont = 10; float *cont = new float[ncont]; for(int i=0;i