Hi,
I need a solution to set Background color YELLOW on SGPLOT:
-I am using SAS 9.2 and creating PNG.
-However,I have tried to solve it via PROC TEMPLATE but it not working?
proc template;
define style styles.default ;
parent = styles.Journal;
style GraphLegendBackground / color=Yellow;
style GraphFonts /
'GraphDataFont' =("Arial",10pt)
'GraphUnicodeFont' = ("Arial",6.5pt)
'GraphValueFont'=("Arial",7.0pt,bold)
'GraphLabelFont'=("Arial",8.2pt,bold)
'GraphFootnoteFont' = ("Arial",8pt)
'GraphTitleFont' = ("Arial",10pt,bold)
'GraphAnnoFont' = ("Arial",10pt);
end;
run;
-But not changing LEGEND Background Color, all other stuffs are okay from that figures.
Thanks in advance
It looks like your creating a circular dependency. Normally, the JOURNAL style inherits from DEFAULT, but here you have overridden DEFAULT and inherited from JOURNAL. Try this instead:
proc template;
define style styles.myjournal ; /* different name */
parent = styles.Journal;
style GraphLegendBackground / color=Yellow;
style GraphFonts /
'GraphDataFont' =("Arial",10pt)
'GraphUnicodeFont' = ("Arial",6.5pt)
'GraphValueFont'=("Arial",7.0pt,bold)
'GraphLabelFont'=("Arial",8.2pt,bold)
'GraphFootnoteFont' = ("Arial",8pt)
'GraphTitleFont' = ("Arial",10pt,bold)
'GraphAnnoFont' = ("Arial",10pt);
end;
run;
ods pdf file="output.pdf" style=myjournal; /* or whatever ODS destination you are using */
< your program >
ods pdf close;
Hope this helps!
Dan
It not worked on after using on:
ODS LISTING GPATH="XX" style=myjournal;
ODS LISTING CLOSE
It is worth pausing to consider if this is a good idea. Color perception is not absolute, but relative to the background. We know that a gray color swatch in black background looks white, and the same gray color in a white background looks black. We intentionally use the same background color as the "Wall" color for the legend, so the colors used in the graph are seen against the same background in the legend. Changing the legend background color to something different from the wall color could have an adverse impact on the perception of the colors.
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!
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.