Data visualization with SAS programming

Changing Colors in Series

Reply
Occasional Contributor
Posts: 14

Changing Colors in Series

I am having problems changing colors on my graphs.  I haven't done a lot of work with graphic so bear with me.

 

This is my code:
proc sgplot data=work.s_av;

where VIMS_SPECIES_CODE=597;
series x=YEAR y=N_OBS;
refline 0 / axis=y lineattrs=(color=black);
title 'Trawl Shrimp Landings and Average Minimum Winter Temperatures'; run;

I'm not sure if it has anything to do with SAS's preset colors, but I am a little confused on all of that anyway.  I've also tried using the RBG code instead of using the color words.

 

Super User
Posts: 11,118

Re: Changing Colors in Series

You question isn't very clear. Which color are you attempting to change? You have lines, markers, text, borders, backgrounds, marker outlines as a minimum that you can provide colors for.

 

Can you show the code that didn't "work" with other colors that you tried and what was not as desired for the output?

Occasional Contributor
Posts: 14

Re: Changing Colors in Series

The code I gave was the code that didn't work.  Attempting to change line color from blue to black.  No matter what I do it just stays blue (or does the default colors, as I've found out).  

Super User
Posts: 11,118

Re: Changing Colors in Series

Which line? The line you have set to black is the REFLINE not the SERIES.

Super User
Posts: 19,080

Re: Changing Colors in Series

You can specify colours using the hex code with a CX in front, 

 

color=cxffffff;

Occasional Contributor
Posts: 14

Re: Changing Colors in Series

I've already tried those codes and it still doesn't work.

Super User
Posts: 19,080

Re: Changing Colors in Series

@jswinford What colour are you trying to change? 

What version of SAS do you have? 

 

 

You can specify colour detail quite easily in SAS 9.4+

http://support.sas.com/documentation/cdl/en/grstatproc/69716/HTML/default/viewer.htm#n18szqcwir8q2nn...

Super User
Posts: 11,118

Re: Changing Colors in Series


jswinford wrote:

I've already tried those codes and it still doesn't work.


I suspect that you had a syntax problem. So show the actual code.

 

Doesn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Ask a Question
Discussion stats
  • 7 replies
  • 101 views
  • 0 likes
  • 3 in conversation