BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Amanda_Lemon
Quartz | Level 8

Hi all - 

 

I am trying to make the font size of all words in my plot to be 14... I succeeded for labels of xaxis and yaxis but not for legendlabels in scatter and in lineparm... How can I change their font size? 

 

proc sgplot data = dataset;
scatter x = x1 y = y1 / jitter legendlabel = "Some label";
lineparm x=0 y=0 slope=1 / lineattrs=(color = red) legendlabel = "Diagonal line";
xaxis label = "Variable X" labelattrs=(size = 14);
yaxis label = "Variable Y" labelattrs=(size = 14);
run;

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @Amanda_Lemon 

 

Please try this:

proc sgplot data=dataset;
	scatter x=x1 y=y1 / jitter name="scatter_name" legendlabel="Some label";
	lineparm x=0 y=0 slope=1 / lineattrs=(color=red) name="diagnonal_name" 
		legendlabel="Diagonal line";
	keylegend "scatter_name" "diagnonal_name" / valueattrs=(size=14);
	xaxis label="Variable X" labelattrs=(size=14) valueattrs=(size=14);
	yaxis label="Variable Y" labelattrs=(size=14) valueattrs=(size=14);
run;
  • To define the size of tick values on each axis, you can add the valueattr= option in both XAXIS and YAXIS statements
  • To define the size of legend labels, you need first to define a "name" for each plot (scatter, lineparm) and then use a KEYLEGEND statement to define custom attributes

 

Best,

View solution in original post

3 REPLIES 3
ed_sas_member
Meteorite | Level 14

Hi @Amanda_Lemon 

 

Please try this:

proc sgplot data=dataset;
	scatter x=x1 y=y1 / jitter name="scatter_name" legendlabel="Some label";
	lineparm x=0 y=0 slope=1 / lineattrs=(color=red) name="diagnonal_name" 
		legendlabel="Diagonal line";
	keylegend "scatter_name" "diagnonal_name" / valueattrs=(size=14);
	xaxis label="Variable X" labelattrs=(size=14) valueattrs=(size=14);
	yaxis label="Variable Y" labelattrs=(size=14) valueattrs=(size=14);
run;
  • To define the size of tick values on each axis, you can add the valueattr= option in both XAXIS and YAXIS statements
  • To define the size of legend labels, you need first to define a "name" for each plot (scatter, lineparm) and then use a KEYLEGEND statement to define custom attributes

 

Best,

Amanda_Lemon
Quartz | Level 8
It works! Thank you so much!!
ed_sas_member
Meteorite | Level 14

Great! You're welcome @Amanda_Lemon 😊

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 17842 views
  • 5 likes
  • 2 in conversation