BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SAS-questioner
Obsidian | Level 7

I used the below codes to create horizontal bar:

proc sgplot data=have;
hbar site/ categoryorder=respdesc datalabelattrs=(Family="Times New Roman" size=11);
xaxis label='Frequency' valueattrs=(Family="Times New Roman" size=11)
												labelattrs=(Family="Times New Roman" size=12);
yaxis label='Site' valueattrs=(Family="Times New Roman" size=11)
												labelattrs=(Family="Times New Roman" size=12);
run;

Since there are too many bars, in y axis, it only shows one label every two bars. I tried to reduce the size of font, but it also only displays one label name every two bars. I can't change the range for y axis since it's not number. Does anyone know how to display every bar name on y axis?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Some options that MAY work depending on your data:

1) Make the axis discrete with the TYPE=DISCRETE option on the yaxis statement.

2) FITPOLICY =NONE  (may also want Discrete)

3) Make the graphic area larger using ODS GRAPHICS Height= option prior to the graph. Reset as needed later.

4) make the Font much smaller, like 5pt or 6pt. The default "units" of size for Text attributes is pixels, which varies from display to display and sometimes. So a test by others with SIZE=11 may "work" because their display uses different resolution than yours. Specifying a unit of size like PT, CM or IN (such as .1in ) may yield better result.

View solution in original post

1 REPLY 1
ballardw
Super User

Some options that MAY work depending on your data:

1) Make the axis discrete with the TYPE=DISCRETE option on the yaxis statement.

2) FITPOLICY =NONE  (may also want Discrete)

3) Make the graphic area larger using ODS GRAPHICS Height= option prior to the graph. Reset as needed later.

4) make the Font much smaller, like 5pt or 6pt. The default "units" of size for Text attributes is pixels, which varies from display to display and sometimes. So a test by others with SIZE=11 may "work" because their display uses different resolution than yours. Specifying a unit of size like PT, CM or IN (such as .1in ) may yield better result.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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