Turn off title in BoxPlots

Reply
Regular Contributor
Posts: 212

Turn off title in BoxPlots

From SAS documentation I don't readily perceive a way to turn off the title in BoxPlots.

Can someone please tell me how to do this?

Perhaps there is some program-wide way, as opposed to an option in Proc BoxPlot itself?

Thanks,

Nicholas Kormanik

Super Contributor
Posts: 543

Re: Turn off title in BoxPlots

Hi,

You have two options - at the very least.

1). turn the ODS graphics off by simply saying:

"ods graphics off" before your plot.

2).Assuming that you use SAS 9.2 or higher (hence you automatically get the ODS Graphics) you can modify the template that is used to render the plot:

proc template;

define statgraph sgdesign;

dynamic _SEX _HEIGHT;

begingraph;

/*  entrytitle halign=center 'Type in your title...';*/

   layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;

      layout overlay;

         boxplot x=_SEX y=_HEIGHT / name='box' boxwidth=0.4 clusterwidth=1.0;

      endlayout;

   endlayout;

endgraph;

end;

run;

proc sgrender data=SASHELP.CLASS template=sgdesign;

dynamic _SEX="SEX" _HEIGHT="HEIGHT";

run;

Hmm, more information is always more helpful.

:-)

Cheers.

Anca.

Regular Contributor
Posts: 212

Re: Turn off title in BoxPlots

Once again with SAS, not as simple as "No title, please."

Good grief, why do they make things so difficult.

Super Contributor
Posts: 543

Re: Turn off title in BoxPlots

It will all get easier.

Persistence!

And a bit of patience.

Super User
Posts: 10,500

Re: Turn off title in BoxPlots

You don't say how the title is being generated. I would try:

title;

before the proc to make sure no title statements are active as a first try.

Otherwise, post the code generating the plot for diagnosis.

Regular Contributor
Posts: 212

Re: Turn off title in BoxPlots

Okay, tried that, simply adding title;, and no difference.  Title still there.

By the way, the reason I'd like to get rid of the title is have more room for the graph.

Here is the code that produces the boxplots:

proc boxplot data=nicholas.boxplots;

plot Change*Single /

boxstyle=skeletal

nohlabel

boxconnect=q3

cconnect=blue

boxwidthscale=1

clipfactor=1.5

clipsymbol=dot

;

insetgroup n;

run;

Super Contributor
Posts: 543

Re: Turn off title in BoxPlots

Hi Nicholas.

Sample data could have helped, BUT I still believe that you should try:

ODS GRAPHICS OFF;

TITLE;

....then your code

When I do that there is no title.

Let us know if it works.

Good luck,

Anca.

Regular Contributor
Posts: 212

Re: Turn off title in BoxPlots

Thanks Anca.  Correct you are.  However, there are aspects to the ODS graphs that are quite nice, thus I'd like to keep ODS on.

Super Contributor
Posts: 543

Re: Turn off title in BoxPlots

Hi Nicholas.

This is what I figured out so far:

____________________________________________________________________

*this is the code that produces your desired plot;

proc sort data = sashelp.class out = t;by sex;

ods graphics on;

proc boxplot data = t;

plot age*sex /boxstyle=skeletal

                        nohlabel boxconnect=q3

                        cconnect=blue boxwidthscale=1 clipfactor=1.5 clipsymbol=dot;

                        insetgroup n;

run;quit;

____________________________________________________________________

OK, so in order to keep the nice features that ODS Graphics provides, but to remove the title, I think you may need to change from PROC BOXPLOT to PROC TEMPLATE + PROC SGRENDER.

So, the one way I figured how to remove the title is by "defining" your own template where you don't use the "ENTRYTITLE" statement (See below, please):

proc template;

define statgraph PrettyBox;

begingraph;

    *entrytitle 'Distribution of Age by Sex';*<----This statement makes your title appear, by default, when you use the ODS GRAPHICS;

        layout overlay;

            boxplot y=age x=sex;

        endlayout;

endgraph;

end;

run;

proc sort data=sashelp.class out=class;by sex;run;

proc sgrender data=class template=PrettyBox;

run;

However, you will need to read about how to "enhance" the graph template definition (which I called "prettyBox") to add the Ns, and the different widths, and all these other things that we both know how to do in PROC BOXPLOT.

OK.

I may return if I come up with a better answer.

:smileyconfused:

New Contributor
Posts: 4

Re: Turn off title in BoxPlots

You want to turn title off... I want to turn it on.  how do i turn on titles on.  Please be patient.  i am a basic user.  i dont know where to

turn the ODS graphics off by simply saying:

"ods graphics off" before your plot.

where do i say this?  can i just say ods graphics on?  using JMP11

Super Contributor
Posts: 543

Re: Turn off title in BoxPlots

Hi.

I don't use JMP, but it would help to repost the question as a separate discussion under JMP.

Not sure if you can use title statements in JMP, but if yes, then you can add something like

title "your title";

proc to make the plot;

title;

Good luck,

Anca.

Ask a Question
Discussion stats
  • 10 replies
  • 2442 views
  • 3 likes
  • 4 in conversation