Tick mark value font SGPLOT

Accepted Solution Solved
Reply
Contributor
Posts: 59
Accepted Solution

Tick mark value font SGPLOT

I have a issue with sgplot. I have categorical y-axis with text values and numerical x axis. I would want to control the x-axis font size separately from the y-axis, since the x-axis font size is just fine, but my y axis values are so long that I would need to reduce the font size. So far I have found proc template the only way to even change the font sizes. However when I change the 'GraphvalueFont' value it affects both the x and y axis. The problem is that now the x-axis becomes unreadable. So is there any way to control those font sizes separately? Could I somehow initialize a new class for example GraphValueText2 or something? Or is the GTL and sgrender the way to go?


Accepted Solutions
Solution
‎09-09-2014 12:34 PM
SAS Super FREQ
Posts: 676

Re: Tick mark value font SGPLOT

Hi

Have you tried the LABELATTRS= and VALUEATTRS= option of the YAXIS statement?

See sample below:

data have;
  do y = "A", "B", "C", "D";
   
length y2 $ 64;
   
call missing(y2);
    do i = 1 to 10;
      y2 = catx(
" ", y2, repeat( y, ceil(ranuni(0) * 8 ))); 
   
end;
  
   
x = ceil( ranuni(0) * 50);
    output;
 
end;
run;

proc sgplot data=have;
  hbar y2 / response=x;
  yaxis
   
labelattrs=( size=5pt color=red )
   
valueattrs=( size=5pt color=red )
/*    fitpolicy=splitalways */
  ;
  xaxis
   
labelattrs=( size=12pt )
   
valueattrs=( size=12pt )
  ;

run;

View solution in original post


All Replies
Solution
‎09-09-2014 12:34 PM
SAS Super FREQ
Posts: 676

Re: Tick mark value font SGPLOT

Hi

Have you tried the LABELATTRS= and VALUEATTRS= option of the YAXIS statement?

See sample below:

data have;
  do y = "A", "B", "C", "D";
   
length y2 $ 64;
   
call missing(y2);
    do i = 1 to 10;
      y2 = catx(
" ", y2, repeat( y, ceil(ranuni(0) * 8 ))); 
   
end;
  
   
x = ceil( ranuni(0) * 50);
    output;
 
end;
run;

proc sgplot data=have;
  hbar y2 / response=x;
  yaxis
   
labelattrs=( size=5pt color=red )
   
valueattrs=( size=5pt color=red )
/*    fitpolicy=splitalways */
  ;
  xaxis
   
labelattrs=( size=12pt )
   
valueattrs=( size=12pt )
  ;

run;
Contributor
Posts: 59

Re: Tick mark value font SGPLOT

Well this is embarrasing, but thanks a lot. I have never encountered with these options in the sas help, but now that I googled it I found them.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 4127 views
  • 1 like
  • 2 in conversation