Data visualization with SAS programming

Some of tick values have bee thinned in SAS Gplot, How can display all tick values?

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Some of tick values have bee thinned in SAS Gplot, How can display all tick values?

[ Edited ]

plot of the odds ratios and their 95% confidence intervals created using SAS PROC SGPLOT, 

 

but some of the tick values have been thinned. How plot the figure without remove or thinned tick values ? 

 

Thanks a lot! 

 

 

 title "SGPLOT: Forest Plot";
   proc sgplot data=excel_b;
    scatter x=oddsratioest y=effect / xerrorlower=lowercl
                                  xerrorupper=uppercl
                                  markerattrs=or
                                 (symbol=DiamondFilled size=5);
    refline 1 / axis=x;
    xaxis label="OR and 95% CI " min=0.9;
    yaxis label="Covariates";
  run;

 

                                                      

vBQcbWl.png

 


Accepted Solutions
Solution
‎07-12-2016 07:52 AM
SAS Super FREQ
Posts: 3,618

Re: Some of tick values have bee thinned in SAS Gplot, How can display all tick values?

With that many discrete vertical labels, there isn't enough room to plot them all without labels overlapping (which SGPLOT tries to avoid). You can

1. Decrease the font size for the tick values. Probably size=8 is about the smallest that can be read.

2. Increase the vertical size of the plot. Plots can stretch arbitrarily long.

3. Do both

 

To decrease the font size, use 

YAXIS / valueattrs=(size=8);

 

To increase the vertical dimension of the graph, use the following BEFORE the call to PROC SGPLOT, For example:

ods graphics / width=500px height=800px;

 

Another option: Since you have two stages, you could use PROC SGPANEL to create a panel of plots, one for each stage.

 

View solution in original post


All Replies
Solution
‎07-12-2016 07:52 AM
SAS Super FREQ
Posts: 3,618

Re: Some of tick values have bee thinned in SAS Gplot, How can display all tick values?

With that many discrete vertical labels, there isn't enough room to plot them all without labels overlapping (which SGPLOT tries to avoid). You can

1. Decrease the font size for the tick values. Probably size=8 is about the smallest that can be read.

2. Increase the vertical size of the plot. Plots can stretch arbitrarily long.

3. Do both

 

To decrease the font size, use 

YAXIS / valueattrs=(size=8);

 

To increase the vertical dimension of the graph, use the following BEFORE the call to PROC SGPLOT, For example:

ods graphics / width=500px height=800px;

 

Another option: Since you have two stages, you could use PROC SGPANEL to create a panel of plots, one for each stage.

 

SAS Super FREQ
Posts: 1,136

Re: Some of tick values have bee thinned in SAS Gplot, How can display all tick values?

Also, you can use FITPOLICY=none for the yaxis.

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 751 views
  • 0 likes
  • 3 in conversation