BookmarkSubscribeRSS Feed
pdsaber
Calcite | Level 5

Hi

 

I want to create a square axis scatter plot with up to  60 legends , I am using proc template and Proc SGrender procedure.(which is kind of standard i have to follow) gplot is not allowed.

 

But the plot is rectangular most of the time. also i have two x y axes.

 

i have tried 

 

layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;
layout overlayequated /equatetype=square

xaxisopts=(griddisplay=off
label="" labelattrs=(family="arial" size=11pt weight=normal)
linearopts=(
viewmin=0.0 viewmax=&xmax_mg. minorticks=ON minortickcount=9
tickvaluesequence=( start=0.0 end=&xmax_mg. increment=&mg_incr.)))
yaxisopts=(
griddisplay=off
label="Glucose Result (mg/dL)" labelattrs=(family="arial" size=11pt weight=normal)
linearopts=(
viewmin=0.0 viewmax=&ymax_mg. minorticks=ON minortickcount=9
tickvaluesequence=( start=0.0 end=&ymax_mg. increment=&mg_incr.)))
x2axisopts=(
label="" labelattrs=(family="arial" size=11pt weight=normal)
linearopts=(
viewmin=0.0 viewmax=%sysevalf(&xmax_mg. / 18.016) minorticks=ON minortickcount=4
tickvaluesequence=( start=0.0 end=&xmax_mm. increment=&mm_incr.)))
y2axisopts=(
label="Glucose Result (mmol/L)" labelattrs=(family="arial" size=11pt weight=normal)
linearopts=(
viewmin=0.0 viewmax=%sysevalf(&ymax_mg. / 18.016) minorticks=ON minortickcount=4
tickvaluesequence=( start=0.0 end=&ymax_mm. increment=&mm_incr.)))
;
scatterplot x= &x_var_mg. y= &y_var_mg. / group=&group. name='scatter';
scatterplot x= &x_var_mg. y= &y_var_mm. / name='scatter2' yaxis=y2 datatransparency=1;
scatterplot x= &x_var_mm. y= &y_var_mg. / name='scatter3' xaxis=x2 datatransparency=1;
annotate;
endlayout;
sidebar / align=bottom spacefill=false;
discretelegend 'scatter' / opaque=true border=false halign=center valign=center displayclipped=true order=rowmajor across=2
title='' titleattrs=(family="arial" size=10pt weight=bold);
endsidebar;
endlayout;
endgraph;
end;
run;quit;

 

but this doesn't work.

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Why on earth would want 60 legends in a plot?

ballardw
Super User

You probably should share your current ODS Graphics settings as you are likely to have a lot of interaction between your graph settings and the display. You may need to adjust the ODS Graphics Height and Width options, likely the Scale option and maybe Legendareamax.

 

You can use the ODS Graphics option SHOW to have your current settings appear in the log if you don't know what they are.

 

 

Example data, including values of any macro variables, with complete code for the template and Sgrender call are needed for us to test anything. You could use a SAS supplied data set to demonstrate or provide an example of your data. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 2 replies
  • 583 views
  • 0 likes
  • 3 in conversation