BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GGO
Obsidian | Level 7 GGO
Obsidian | Level 7

Hi All - I've searched these boards and beyond, but cannot find an answer to what seems like a simple query.

 

I'm relying on 9.4 SAS ODS Graphics documentation, especially:

Why does the GRAPH BORDERCOLOR setting *not* work in this simple example?

 

*--- Demo Data ;
proc sql;
  create table hilo_data
  ( label char(15) label='Label for High-Low element'
  , low num(8) label='Low value for High-Low plot'
  , high num(8) label='High value for High-Low plot'
  , y_val num(8) label='Y-axis value for High-Low plot'
  , lcap char(15) label='Low Cap style for High-Low bars'
  , hcap char(15) label='High Cap style for High-Low bars'
  )
;

insert into hilo_data

  values('One', 1, 5, -1, 'filledArrow', '')
  values('Two', 2.5, 7.5, -2, '', '')
  values('Tre', 5, 10, -3, '', '')
  values('For', 7.5, 12.5, -4, '', '')
  values('Fiv', 10, 15, -5, '', 'filledArrow')
  ;
quit;

*--- MODIFY BORDER COLOR and AXIS COLOR ;
proc template;
  define style Modify_Graph_BorderColor;
  parent=styles.statistical;
    *--- No idea why sgplot IGNORES this element ;
    style Graph from Graph /
          BorderColor = RED
          BorderWidth = 10;
    *--- But sgplot DOES x/y axes CYAN ;
    style GraphAxisLines from GraphAxisLines /
          ContrastColor = CYAN;
  end;
run;

*--- SGPLOT ;
ods listing style=Modify_Graph_BorderColor;

ods graphics on /
    imagename="test_highlow"
    height = 6in width = 4in
    reset=index noBorder;

proc sgplot data = hilo_data ;

  yaxis display = (nolabel noticks novalues);

  highLow
    y = y_val
    high = high
    low = low /
        clipCap
        type = bar
        barwidth = 0.5
        lowLabel = label
        highCap = hcap
        lowCap = lcap;
quit;

 

That should give you something this - CYAN axes, but NO RED top and right border:

cyan_only.PNG

 

What's the secret to modifying those remaining BorderColors?

1 ACCEPTED SOLUTION

Accepted Solutions
sdengland
SAS Employee

The Graph style element applies to SAS/GRAPH. We will remove it from the ODS Graphics documentation. For the overall graph border in ODS Graphics, try setting GraphBorderLines in your style template:

*--- MODIFY BORDER COLOR and AXIS COLOR ;
proc template;
  define style Modify_Graph_BorderColor;
  parent=styles.statistical;
    *--- No idea why sgplot IGNORES this element ;
    style GraphBorderLines from GraphBorderLines /
          contrastColor = RED
          lineThickness = 1px;
    style graphWalls from graphWalls /
          contrastcolor = PURPLE
          lineThickness = 1px;
    *--- But sgplot DOES x/y axes CYAN ;
    style GraphAxisLines from GraphAxisLines /
          ContrastColor = CYAN;
  end;
run;

Be sure to specify border=on in your ODS GRAPHICS statement. Be aware that GraphBorderLines affects legend borders as well. We will update the documentation to correct the NOWALL option description as Dan mentioned (thanks, Dan) and to use consistent terminology for the wall outline. Thanks for bringing this to our attention.

View solution in original post

6 REPLIES 6
sdengland
SAS Employee

Hi GGO,

The top and right borders are part of the graph wall border. In your style template, try setting GraphWalls:

 

*--- MODIFY BORDER COLOR and AXIS COLOR ;
proc template;
  define style Modify_Graph_BorderColor;
  parent=styles.statistical;
    *--- No idea why sgplot IGNORES this element ;
    style graphWalls from graphWalls /
          contrastcolor = RED
          lineThickness = 1px;
    *--- But sgplot DOES x/y axes CYAN ;
    style GraphAxisLines from GraphAxisLines /
          ContrastColor = CYAN;
  end;
run;

For more information, see Axis Line versus Wall Outline in SAS Graph Template Language: User’s Guide.

 

GGO
Obsidian | Level 7 GGO
Obsidian | Level 7

Thank you, SDengland! That worked. Sort of.

 

Unfortunately, this terminology all seems muddled to me.

  • sgplot ... noBORDER "removes the data-area border from the plot",
  • which should apparently reference the (graphwall) outline, instead.
  • sgplot ... noWALL "turns off the display of the graph wall’s fill and outline",
  • but actually does NOT turn off the graphwall outline (see 2nd pic, below).
  • And the outline is actually modified by the GraphWall ContrastColor setting ...

I'm sure it all makes sense, somehow ... but not really.

 

The magic combination that seems to achieve my objective (control color or graphwall outline, aka data-area border) is:

  • template snippet: style GraphWalls ... ContrastColor = purple
  • GraphWalls-ContrastColor.PNG

 

As mentioned below, this still does not explain why

  • the sgplot ... noWALL option does not turn "off the display of the graph wall’s fill and outline" (purple)
  • GraphWalls-ContrastColor-noWALL.PNG
  • although the sgplot ... noborder option does

 

And no matter what I do, the overall graph border ... red in my template above ... never appears. I've tried:

  • that template style Graph ... BorderColor, above
  • ods graphics ... border=on
  • ...
DanH_sas
SAS Super FREQ

Hey @GGO , this is just a mistake in the documentation. The NOWALL and NOBORDER options are independent switches so that you have full control over the wall. The NOWALL option removes only the wall fill, while NOBORDER removes the wall border. If you want to get rid of both, specify both options. Here is a little program to demonstrate the point:

 

proc sgplot data=sashelp.class;
styleattrs backcolor=yellow;
scatter x=weight y=height;
run;

proc sgplot data=sashelp.class nowall;
styleattrs backcolor=yellow;
scatter x=weight y=height;
run;

proc sgplot data=sashelp.class noborder;
styleattrs backcolor=yellow;
scatter x=weight y=height;
run;

proc sgplot data=sashelp.class nowall noborder;
styleattrs backcolor=yellow;
scatter x=weight y=height;
run;

Hope this helps!

Dan

sdengland
SAS Employee

The Graph style element applies to SAS/GRAPH. We will remove it from the ODS Graphics documentation. For the overall graph border in ODS Graphics, try setting GraphBorderLines in your style template:

*--- MODIFY BORDER COLOR and AXIS COLOR ;
proc template;
  define style Modify_Graph_BorderColor;
  parent=styles.statistical;
    *--- No idea why sgplot IGNORES this element ;
    style GraphBorderLines from GraphBorderLines /
          contrastColor = RED
          lineThickness = 1px;
    style graphWalls from graphWalls /
          contrastcolor = PURPLE
          lineThickness = 1px;
    *--- But sgplot DOES x/y axes CYAN ;
    style GraphAxisLines from GraphAxisLines /
          ContrastColor = CYAN;
  end;
run;

Be sure to specify border=on in your ODS GRAPHICS statement. Be aware that GraphBorderLines affects legend borders as well. We will update the documentation to correct the NOWALL option description as Dan mentioned (thanks, Dan) and to use consistent terminology for the wall outline. Thanks for bringing this to our attention.

GGO
Obsidian | Level 7 GGO
Obsidian | Level 7

Much appreciated, Dan and SDEngland!

 

GraphBorderLines ContrastColor (red) does the trick ... although I never would have tried this based on the documentation:

 

 

Nothing in that "Portion of Graph Affected" suggests the color of the lines around the overall graph, which is in fact what this element controls:

 

  • GraphBorderLines-ContrastColor.PNG

 

There are amazing capabilities here, but misleading or wrong documentation renders those capabilities inaccessible and frustrating. I think I was mainly using the appropriate documentation, taking an appropriate approach, but something that should have taken 5min has now taken multiple hours over several days (with my customer/boss waiting anxiously for publishable data displays to their liking ...).

 

So thank you, both, especially for taking the documentation aspect seriously, as you've indicated, and working to clean this up.

sdengland
SAS Employee

GGO,

 

I apologize for the problems that the documentation has caused you. We will correct the documentation for the next release of SAS. Thank you very much for your feedback.

 

Best regards,

Steve

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 4173 views
  • 1 like
  • 3 in conversation