Hi,
I'm struggling with a quite simple issue.
As an example I'm using:
What I want to achieve is to move continuouslegend to the left side and also title and values to left side of the legend.
Final image should look like this:
Try some combination of a LAYOUT LATTICE and a SIDEBAR. This isn't perfect, but maybe it will give you some ideas to pursue:
proc template;
define statgraph attrmap;
begingraph;
entrytitle "Height and Weight Distribution" ;
/* Define the attribute map and assign the name "densityrange." */
rangeattrmap name="densityrange" ;
range MIN - 0.0004 / rangealtcolor=blue ;
range 0.0004 < - 0.0014 / rangealtcolormodel=(lightpurple lightred) ;
range 0.0014 < - 0.002 / rangealtcolor=red ;
endrangeattrmap ;
/* Associate the attribute map with input data column Density and
assign variable name RANGEVAR to the named association */
rangeattrvar attrvar=rangevar var=density attrmap="densityrange" ;
/* Reference RANGEVAR in the SCATTTERPLOT statement */
layout lattice / columns=2 columnweights=(0.1 0.9);
sidebar / align=left;
entry halign=left "Density" / rotate=90 ;
endsidebar;
continuouslegend "scatter" / orient=vertical
halign=left title="";
scatterplot x=height y=weight / markercolorgradient=rangevar
markerattrs=(symbol=squarefilled size=6px) name="scatter";
endlayout;
endgraph;
end;
ods graphics / reset width=475px;
proc sgrender data=sashelp.gridded(where=(count>0)) template=attrmap;
run;
Bump
Try some combination of a LAYOUT LATTICE and a SIDEBAR. This isn't perfect, but maybe it will give you some ideas to pursue:
proc template;
define statgraph attrmap;
begingraph;
entrytitle "Height and Weight Distribution" ;
/* Define the attribute map and assign the name "densityrange." */
rangeattrmap name="densityrange" ;
range MIN - 0.0004 / rangealtcolor=blue ;
range 0.0004 < - 0.0014 / rangealtcolormodel=(lightpurple lightred) ;
range 0.0014 < - 0.002 / rangealtcolor=red ;
endrangeattrmap ;
/* Associate the attribute map with input data column Density and
assign variable name RANGEVAR to the named association */
rangeattrvar attrvar=rangevar var=density attrmap="densityrange" ;
/* Reference RANGEVAR in the SCATTTERPLOT statement */
layout lattice / columns=2 columnweights=(0.1 0.9);
sidebar / align=left;
entry halign=left "Density" / rotate=90 ;
endsidebar;
continuouslegend "scatter" / orient=vertical
halign=left title="";
scatterplot x=height y=weight / markercolorgradient=rangevar
markerattrs=(symbol=squarefilled size=6px) name="scatter";
endlayout;
endgraph;
end;
ods graphics / reset width=475px;
proc sgrender data=sashelp.gridded(where=(count>0)) template=attrmap;
run;
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.