Data visualization with SAS programming

Color of bars change after saving the bar graphs to a pdf

Accepted Solution Solved
Reply
Contributor
Posts: 40
Accepted Solution

Color of bars change after saving the bar graphs to a pdf

Hello everyone,

 

I would like to save my bar graphs to a pdf with gray and white colors. So I use this style:

 

 

proc template;
define style barcolors;
parent = styles.htmlblue; style GraphData1 from GraphData1 / color = white contrastcolor=black; style GraphData2 from GraphData2 / color = white contrastcolor=black; end;
run;
ods html style = barcolors;

 

Now, my sgplot code is:

options nodate nonumber;

ods pdf file=’bars.pdf’;

goptions device=pdf colors=(black) rotate=landscape;

title "........";

proc sgplot data = mydataset;

vbar variable1/group=categoricalVariable response=PercentVariable groupdisplay=cluster;

run;

 

When I run this code, in the "results viewer" window, I see the gray-white bars. But when I open the pdf file, the colors are blue and red. How can I save the output in PDF by keeping the styles of bars?

Any help is appreciated Smiley Happy

proc sgplot;

 

 

 

 

 


Accepted Solutions
Solution
‎06-23-2016 04:23 PM
SAS Super FREQ
Posts: 864

Re: Color of bars change after saving the bar graphs to a pdf

You also need to specify the style on your ODS PDF statement:

 

ods pdf style=barcolors;

View solution in original post


All Replies
Solution
‎06-23-2016 04:23 PM
SAS Super FREQ
Posts: 864

Re: Color of bars change after saving the bar graphs to a pdf

You also need to specify the style on your ODS PDF statement:

 

ods pdf style=barcolors;

Contributor
Posts: 40

Re: Color of bars change after saving the bar graphs to a pdf

Thank you very much. It worked Smiley Happy

Post a Question
Discussion Stats
  • 2 replies
  • 137 views
  • 1 like
  • 2 in conversation