Data visualization with SAS programming

proc sgplot width of the labels

Reply
Contributor
Posts: 46

proc sgplot width of the labels

Hi, everbody!

I'm using the proc sgplot and trying to control de width of the label (as you can see in the image).

How can I change the width of the xaxis ?

Doubt.png

My code:

graphics on / height=3in width=10.5in noborder;

proc sgplot data=tmpgrafico;

vbar Teste /   response=Volume legendlabel="Volume" barwidth=0.7;

vbar Teste / response=Volume_Dt legendlabel="Volume_Dt" barwidth=0.4;

yaxis label='Volume';

run;

tk's in advantage....

Respected Advisor
Posts: 4,812

Re: proc sgplot width of the labels

Add

XAXIS FITPOLICY=THIN; 

I think it's a v9.3 feature...

PG

PG
Super User
Posts: 11,118

Re: proc sgplot width of the labels

FITPOLICY is in 9.2.3 as well. Other options you might try are STAGGER, STAGGERROTATE, STAGGERTHIN, ROTATETHIN

The format associated with the X axis variable controls what is attempted to display. You might try adding Format teste ddmmyyn4. ;

which should have  fewer characters but shouldn't show year values so may be problematic for some uses.

N/A
Posts: 1

Re: proc sgplot width of the labels

Is there anyway to rotate to 90?


Respected Advisor
Posts: 4,812

Re: proc sgplot width of the labels

As far as I know (up to version 9.3 anyway) you cannot rotate to 90 degrees in SG graphics. You can however in SAS/GRAPH graphics, if you define an axis with the VALUE option and the ANGLE suboption. I find it very awkward to use.

What you might also try in SG graphics is to increase the image resolution with option IMAGE_DPI=300 on your ODS LISTING or ODS HTML statement. This has for side effect to decrease the size of all text strings on the graph. - PG

PG
SAS Super FREQ
Posts: 1,139

Re: proc sgplot width of the labels

Not sure what you mean by "Change the width of this label".  If you want to change the font size of the tick values, you can do that using valueattrs.  Vertical tick values are supported at SAS 9.4 in GTL (see example below).  In your case, with so many tick values, you could try two other possibilities. 

  - Use a horizontal bar chart, so the date values are on the Y axis.

  - If this is really a time axis, use a time axis with needle plots.

heart1.png

Ask a Question
Discussion stats
  • 5 replies
  • 1201 views
  • 6 likes
  • 5 in conversation