BookmarkSubscribeRSS Feed
Cingchih
Quartz | Level 8
proc sgplot data=sashelp.gridded(where=(count>0));
  scatter x=height y=weight /
       colorresponse=density  name="scatter"
       markerattrs=(symbol=squarefilled size=6px);
  gradlegend "scatter"  ;
run;

Hi all,

I wanted to enlarge the word in the gradlegend.

Image 003.png

It still can't solve the problem by using the VALUEATTRS= option (see here).  

gradlegend "scatter"/ valueattrs=(size=16);

Thanks.

 

Image 004.png

 

 

1 REPLY 1
RichardDeVen
Barite | Level 11

The SGPLOT "GRADLEGEND Statement" documentation has a link to "Optional arguments"  The link incorrectly takes you to the optional arguments of the "KEYLEGEND Statement". 

 

The SGPLOT GRADLEGEND Statement does not support the / VALUEATTRS= option.  This could be a development oversight, or by choice -- who knows ?

 

The SGPLOT statements are interfaces that surface the very wide capabilities of the Graphics Template Language (GTL) and there are places such as this where some GTL functionality is NOT surfaced.

 

In your situation, you can drop down to GTL and write template code that SGRENDER uses to produce the same plot AND supports changing the size of legend values.  The important GTL statements you will use are:

  • SCATTERPLOT, and
  • CONTINUOUSLEGEND

Example:

 

 

proc template;
  define statgraph gridly;
    begingraph;
      layout overlay;

        scatterplot X=Height Y=Weight /
          colorresponse=density
          markerattrs=(symbol=squarefilled size=6px)
          name="sp"
        ; 
        continuouslegend "sp" /
          valueattrs=(size=16pt)          /* Larger font size for legend values */
        ;
      endlayout;   
    endgraph;
  end;
run;

proc sgrender data=sashelp.gridded template=gridly;
  where count > 0;
run;

 

Output

RichardADeVenezia_0-1586412560545.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1424 views
  • 0 likes
  • 2 in conversation