Hi, I'm struggling with getting range attirbute maps to work correctly. Mainly been using Sanjay Metange's blog post as base https://blogs.sas.com/content/graphicallyspeaking/2013/04/14/attributes-map-3-range-attribute-map/ This is done using version 9.4.3.0. Programmed in EG 7.15 HF3. I get he code in the example to run but when trying with my own data I only get a uniform color.. Example data and my programs are below. I also have another question. This is actually a data representing a map. I can get equated axis right using the GTL language, but can't find a function other than manipulating height and width when using SGPLOT. Is this right? If so are there any plans of including true equated columns in SGPLOT? /*Just create some example data*/
Data range;
call streaminit(123);
do x=10 to 30 by 1;
do y=10 to 60 by 2;
u = rand("Uniform");
value= -0.5 + (0.5 - (-0.5))*u;
output;
end;
end;
run;
/*Create the range attribute map*/
data clrresp;
retain id "slope";
length min max $ 5 color altcolor colormodel1 colormodel2 $ 18;
input min $ max $ color $ altcolor $ colormodel1 $ colormodel2 $;
datalines;
_min_ -0.3 . . purple purple
-0.3 -0.15 . . purple blue
-0.15 -0.07 . . blue lightblue
-0.07 0 . . lightblue cxf7f7f7
0 0 white white . .
0 0.07 . . cxf7f7f7 gold
0.07 0.15 . . gold red
0.15 0.3 . . red darkred
0.3 _max_ . . darkred darkred
;
run;
/*Do the plot, not trying to do equated axis*/
proc sgplot data=range
RATTRMAP=clrresp;
scatter x=x y=y /
colorresponse=value
markerattrs=(SYMBOL=SQUAREFILLED SIZE=5PX)
rattrid=slope
;
run;
/*Using equated axis and trying to get the consistent range to work*/
proc template;
define statgraph constrange;
begingraph;
rangeattrvar attrvar=attrvar var=value attrmap='slope';
rangeattrmap name='slope';
range -1 - -0.3 / rangecolormodel=(purple purple);
range -0.3 - -0.15 / rangecolormodel=(purple blue);
range -0.15 - -0.07 / rangecolormodel=(blue lightblue);
range -0.07 - 0 / rangecolormodel=(lightblue cxf7f7f7);
range -0 -0/ rangecolor = white;
range 0 - 0.07 / rangecolormodel=(cxf7f7f7 gold);
range 0.07 - 0.15 / rangecolormodel=(gold red);
range 0.15 - 0.3 / rangecolormodel=(red darkred);
range 0.3 - 1 / rangecolormodel=(darkred darkred);
endrangeattrmap;
* EntryTitle "Parameter = &sumvar, i=&i, j=&j, k=&k" /;
layout Overlayequated / cycleattrs=true
xaxisopts=(display = (ticks tickvalues line ))
yaxisopts=( display=( ticks tickvalues line ))
;
ScatterPlot X='x'n Y='y'n /
colorresponse=attrvar
subpixel=off
primary=true
Markerattrs=( Symbol=SQUAREFILLED size=5 px)
LegendLabel="Y" NAME="Map";
ContinuousLegend "Map"/ title="Lofs variability";* location=inside autoalign=(bottom);
endlayout;
endgraph;
end;
run;
/*Render the graph. result not shown*/
ods graphics on ;
proc sgrender data=range template=constrange;
run;
... View more