* A Grads script to draw legends for line plots having line and marker * *TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT * Author : Martin V. Mathew, Indian Institute of Technology Kharagpur * Prepared on: 26 September 2011 * Last modified on :31 July 2013 * Please report bugs in following email: vmartinmathew@gmail.com *LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL * function legend_lin_mkr(args) * args = strtXpstn strtYpstn mkrStyl LnStyl txt if (args='') say 'Apparent error in use of script legend_lin_mkr.gs' usage() return endif if (arg='-h') usage() return endif strtXpstn=subwrd(args,1) strtYpstn=subwrd(args,2) mkrStyl=subwrd(args,3) LnStyl=subwrd(args,4) clr=subwrd(args,5) txt=subwrd(args,6) txtclrIn=subwrd(args,7) mkrSz=subwrd(args,8) txtSz=subwrd(args,9) if (strtXpstn >1) say ' Error x-position given is outside the limit [0 - 1]' say ' Input argument currently entered is: 'strtXpstn usage() return endif if (strtYpstn >1) say ' Error y-position given is outside the limit [0 - 1]' say ' Input argument currently entered is: 'strtYpstn usage() return endif if (mkrStyl<0|mkrStyl>11) say ' Number indicating marker type, is outside the limit [0 11]' say ' Input argument currently entered is: 'mkrStyl usage() return endif if (LnStyl<0|LnStyl>7) say ' Number indicating Line style, is outside the limit [0 7]' say ' Input argument currently entered is: 'LnStyl usage() return endif if (clr<0|clr>15) say ' Number indicating color for line and marker , is outside the limit [1 15]' say ' Input argument currently entered is: 'clr usage() return endif if (txtclrIn<0|txtclrIn>15) say ' Number indicating color for line and marker , is outside the limit [1 15]' say ' Input argument currently entered is: 'txtclrIn usage() return endif if (txtclrIn= '' ) txtclr=1 else txtclr=txtclrIn endif if (mkrSz= '' ) mkrSize=0.07 else mkrSize=mkrSz endif if (txtSz= '' ) TextSiz=0.1 else TextSiz=txtSz endif * --------------------------------------------------- 'q gxinfo' xref=subwrd(result,14) yref=subwrd(result,20) x2=subwrd(result,16) y2=subwrd(result,22) xpstn=xref+(x2-xref)*strtXpstn ypstn=yref+(y2-yref)*strtYpstn lengt=0.35;* Length of the legend line spc=0.07;* Space between legend line and assoiated text xEndPstn=xpstn+lengt xTxtStrt=xEndPstn+spc * --------------------------------------------------- * Drawing legend * --------------------------------------------------- 'set line 'clr' 'LnStyl;*set line color#