\cancel mode verify ! fill_between.jnl ! 6/99 *sh* ! From Weimin Wang/Steve Hankin emails July 2000 ! cleanup Ansley Manke 10/2000 ! Bug fix: 3/2004 for depth axis polygon overlay was not drawn. ! Description: Fill between two curves or a curve and a constant value ! Usage: $1 $2 $3 $4 ! yes? GO fill_between polygon_command data axis [base] ! $1 - the polygon command with qualifiers (eg POLYGON/OVER/PALETTE=GREEN ! $2 - a variable -- as if it were being plotted ! $3 - the axis name for variable "data" ! $4 - base curve or offset value. If omitted, shade between "data" and 0. ! example ! define axis/t=1-jan-1990:1-mar-1990:1/unit=days tday ! let a = SIN(T[gt=tday]/10) ! let b = 0.4*cos(T[gt=tday]/4) - 2 ! plot a, b ! go fill_between poly/over/palette=red/line a tday b ! go fill_between poly/over/palette=yellow a tday 1. ! go fill_between poly/over/palette=green b tday -3 ! example with a depth axis ! use levitus_climatology ! let a = temp[y=0,x=180] ! let b = temp[y=60,x=180] ! plot a,b ! go fill_between poly/over/palette=green/line/nolab a zaxlevitr b ! argument check QUERY/IGNORE $1"i|Y>j|Z>k|T>l|Z|Y>Z|Z>Y|T>Z|i|Y>j|Z>k|T>l|POINT>i|Z|Y>Z|Z>Z|T>Z|POINT>Z|fill|Y>fill|T>fill|Z>transpose|") DEFINE SYMBOL FB_mult ($FBax"|X>1|Y>1|T>1|Z>-1|") $1/($FB_orient)/coord_ax=($FBbar_ax) FBx4_1, FBy4_1 IF `($FB_mult) LT 0` THEN $1/nolab/($FB_orient)/coord_ax=($FBbar_ax) ($FB_mult)*FBx4_1, ($FB_mult)*FBy4_1 ! In case of a POLY/LINE command, also overlay with the opposite sign. IF `($FB_mult) LT 0` THEN $1/over/nolab/($FB_orient)/coord_ax=($FBbar_ax) FBx4_1, ($FB_mult)*FBy4_1 cancel symbol FB* cancel variable FB* set mode/last verify