Data visualization with SAS programming

Formatting Boxplot to fit data - graph created has too much white space

Accepted Solution Solved
Reply
Contributor
Posts: 71
Accepted Solution

Formatting Boxplot to fit data - graph created has too much white space

The attached boxplot looks great, other than the fact that I have a ton of white space. I wamt wanting to make the width of the graph smaller or the width of the box plots themsevles larger. I have been trying to do this using bwidth option, but with no luck. I am needing to put this plot on a poster, but the grash produced is difficult to read. Thank you for any help you can give. Below is the SAS code used to create the box plot.

proc boxplot data=resident;

goptions ftext=CENTX;

symbol value = dot color=red;

plot percent*time/

cboxfill = ywh haxis = axis1 vaxis=axis2 ;

run;


Accepted Solutions
Solution
‎03-28-2012 11:06 AM
Valued Guide
Posts: 763

Re: Formatting Boxplot to fit data - graph created has too much white space

hi ... you can also try using the HPOS goption ...

proc sort data=sashelp.class out=class;

by sex;

run;

goptions reset=all ftext='calibri/bo';

symbol value = dot color=red;

title 'default HPOS';

proc boxplot data=class;

plot height*sex/ cboxfill = ywh  ;

run;

goptions hpos=30;

title 'change HPOS to 30';

proc boxplot data=class;

plot height*sex/ cboxfill = ywh  ;

run;

more reading ...

HPOS is discussed is ... http://support.sas.com/rnd/datavisualization/papers/GraphBasics.pdf

and on ... http://www.sascommunity.org/wiki/Changing_the_Appearance_of_Vertical_Bar_Charts_using_the_HPOS_Optio...

View solution in original post

Attachment
Attachment

All Replies
SAS Employee
Posts: 5

Formatting Boxplot to fit data - graph created has too much white space

Hi HyunJee,

You can try something like this:

proc boxplot data=resident;

   plot percent * time / hoffset=25 boxwidth=10;

run;

HOFFSET=25 places the first tick mark 25% of the way across the graph.  BOXWIDTH=10 sets the width of each box to 10% of the graph width.  You can adust those values to your liking.

Bucky

Solution
‎03-28-2012 11:06 AM
Valued Guide
Posts: 763

Re: Formatting Boxplot to fit data - graph created has too much white space

hi ... you can also try using the HPOS goption ...

proc sort data=sashelp.class out=class;

by sex;

run;

goptions reset=all ftext='calibri/bo';

symbol value = dot color=red;

title 'default HPOS';

proc boxplot data=class;

plot height*sex/ cboxfill = ywh  ;

run;

goptions hpos=30;

title 'change HPOS to 30';

proc boxplot data=class;

plot height*sex/ cboxfill = ywh  ;

run;

more reading ...

HPOS is discussed is ... http://support.sas.com/rnd/datavisualization/papers/GraphBasics.pdf

and on ... http://www.sascommunity.org/wiki/Changing_the_Appearance_of_Vertical_Bar_Charts_using_the_HPOS_Optio...

Attachment
Attachment
☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 370 views
  • 3 likes
  • 3 in conversation