Data visualization with SAS programming

Change color of conficence interval in SGPLOT

Reply
New Contributor
Posts: 2

Change color of conficence interval in SGPLOT

Hi all!

I want to change the color for my clm in my regression in sgplot. I've formed a teplete for the lines (color and dashing), but don't know how I do it for the clm. 

 

proc template;
define style styles.mystyle;
parent=styles.default;
style body from body / background = white;
class graphbackground / color=white;
style GraphData1 from GraphData1 / contrastcolor=DAGRAY linestyle=5 ;
style GraphData2 from GraphData2 / contrastcolor=MEGR linestyle=4;
end;
run;

 

Thanx for you help!

SAS Employee
Posts: 51

Re: Change color of conficence interval in SGPLOT

Hello,

 

Copied from:

Paper 095-2011

The Power to Plot: Three Ways to Enhance SG Graphical Outputs

Xiangxiang Meng, University of Cincinnati, Cincinnati, OH

http://support.sas.com/resources/papers/proceedings11/095-2011.pdf

 

In general, graphical outputs are controlled by the style elements with prefix "Graph". For instance, GraphConfidence
is for the confidence area, and GraphLegendBackground is for the background of the legend. The objected-oriented
nature of ODS style definition makes it very easy and flexible to add or adjust graphical elements in a ODS style:

*[Example 4.1] Simple examples for applying modified ODS style;
proc template;
 define style styles.LasVegas1;
   parent = styles.default;
   style GraphConfidence from GraphConfidence / color=CXE8D898;
   style GraphLegendBackground                / transparency=1;
 end;
run;
ods html style=LasVegas1;
proc sgplot data=cars_small;
  reg     x=weight y=MSRP / degree=2 clm;
  scatter x=weight y=invoice;
run; quit;

This example changes the color of the confidence area and makes the legend transparent. Note that the second
class "GraphLegendBackground" is created instead of from inheritance since no such class has been defined in the
ODS style DEFAULT.

 

Koen

New Contributor
Posts: 2

Re: Change color of conficence interval in SGPLOT

Thank you!!

I had to modify it since I have two groups. This worked in the end:

 

style GraphData1 from GraphData1 /color =#8C8C8C linestyle=4 contrastcolor=DAGR ;
style GraphData2 from GraphData2 /color= #BFBFBF linestyle=4 contrastcolor=DAGRAY;

 

Best/

Emilia

Ask a Question
Discussion stats
  • 2 replies
  • 189 views
  • 0 likes
  • 2 in conversation