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

Hello Everybody,

 

Reeza showed me to a custom style template that follows Stephen Few's visualization practices. I'm trying to use that to create a custom style template for my organization (attached). For the most part it seems to be doing what I want except for this:

 

When I run this code, all my custom chart colors show up in the bars:

 

ods html style=Styles.My_Custom_Style;

title 'Counts by Type';

proc sgplot data=sashelp.cars;

vbar type/ group=type;

run;

 

but when I run this:

 

ods html style=Styles.HACustom;

title 'Counts by Type';

proc sgplot data=sashelp.cars;

vbar type;

run;

 

the bar fill seems to be a default light blue. How can I get it to use my custom colors?

 

Thanks,

 

Brian

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

When you do not have a GROUP on VBAR statement, the default color for the bars is retrieved from the GraphDataDefault style element, not GraphData1-N. If you want to use one of the GraphData1-N colors, the simplest way is to do the following:

 

vbar type / fillattrs=GraphData1;

 

Hope this helps!

Dan

View solution in original post

5 REPLIES 5
DanH_sas
SAS Super FREQ

When you do not have a GROUP on VBAR statement, the default color for the bars is retrieved from the GraphDataDefault style element, not GraphData1-N. If you want to use one of the GraphData1-N colors, the simplest way is to do the following:

 

vbar type / fillattrs=GraphData1;

 

Hope this helps!

Dan

BTAinRVA
Quartz | Level 8

Thanks again Dan!

BTAinRVA
Quartz | Level 8

Dan,

 

Maybe I should post this in a new thread but I was wondering why when I run the code below

 

ods html style=Styles.My_Custom_Style;

proc sgplot data=aviator.aviator_demogs nocycleattrs;

histogram age_f18 / fillattrs=GraphData1 name='s' binstart=20 binwidth=2 transparency=0.5;

density age_f18 /type=kernel ;

histogram age_T45 / fillattrs=GraphData2 name='d' binstart=20 binwidth=2 transparency=0.5;

density age_T45 /type=kernel ;

keylegend 's' 'd' / location=inside position=topright across=1 noborder ;

yaxis offsetmin=0 ;

xaxis label="AGE" ;

run;

 

and then I run this code

 

proc npar1way data=aviator.Demog_vitals wilcoxon median

plots=(wilcoxonboxplot medianplot);

class AIRCRAFT;

var AGE;

run;

 

the wilcoxonboxplot and medianplot seem to have the same transparency setting as the SGPlot output. Is there a way to override this?

DanH_sas
SAS Super FREQ

The SGPLOT code has no effect on the NPAR1WAY run. Run the NPAR1WAY by itself, and you should get the same result. You will need to check the template(s) use by that procedures and adjust them if you need to modify the output.

BTAinRVA
Quartz | Level 8
Thanks!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 5 replies
  • 883 views
  • 2 likes
  • 2 in conversation