BookmarkSubscribeRSS Feed
Yiting
Quartz | Level 8

Capture.PNG

I assume the place to change the color of the bars in on the right side, Fill...

 

but when I clicked on those squares, nothing happened...

9 REPLIES 9
Madelyn_SAS
SAS Super FREQ

It looks like you have only two group values, so the only color buttons that apply are the first two. It looks like your chart is using those two colors, although the graph colors look a bit lighter. Have you adjusted the transparency setting? 

Yiting
Quartz | Level 8

Thank you for your feedback. Yes, I only have 2 groups and the colors being used are the first two. But I dont want these two colors, how can I change it? Or at least, i want to switch the color of the two groups.

Madelyn_SAS
SAS Super FREQ

You don't say which version you are using but the steps should be the same for any version. To change the color for the two groups, click the first two color buttons to open the palette. So, here I am changing the first color from red to purple. Are these steps not working for you? If the color palette is not opening for you at all, make sure that your browser is zoomed to 100%. If that is not an issue, then log out and try in a new session. Finally, which browser are you using? Can you try with a different supported browser?

 

colors.jpg

Yiting
Quartz | Level 8

i got your point. i guess it works. will try it later... now out of office... thanks!

Felipe_bortolo
Fluorite | Level 6

I’m not sure if you want to change the colors by groups or if you want to change the colors by bars. But I was trying to find out how to change the colors of specific bars and I got it. So I’ll share, hoping it could help.

 

Before I explain, I must say that I’m using SAS VA in Brazilian Portuguese. So, the references to buttons names could be a little different.

 

Now, going to the point, if you want to change the colors of specific bars you’ll have to:

  1. Select your graph and click on the “Exhibition rules” button;
  2. Add a new rule;
  3. Select the field that represents the category of the plot;
  4. Insert the name of the specific category you want to change the color in the blank space; and
  5. Set the color of the bar.

 

I hope it could help somebody!

touwen_k
Pyrite | Level 9

Thank you for putting this. It was also my question how to change colors per bar. I understood that for every bar you have to add a new rule? Then there are a lot of rules you need to add. I hoped there is an easier way.

touwen_k
Pyrite | Level 9

To have different colours in you bar chart, you have to group the items accordingly. To group you create a new data item --> custom category and you create as many groups as you need for you column. Then you add bar chart, choose you new custom category as group. Then the bars will be in different colours. I hope it helps.

DrAbhijeetSafai
Pyrite | Level 9

Correct! I am also finding answer to this question. The question is - There are two colors in the graph for bars - blue and red. Now I want to change these colors. What is the way to change these colors? Is there is some option somewhere where I can use something like colors = (gray, green) etc.? Thanks in advance. 

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
DrAbhijeetSafai
Pyrite | Level 9

I got the answer at least to my question. Thanks to my colleague Akash Kadam. 

 

First let me share that my question was not related to SAS Viya but it was related to Base SAS. 

 

I used following code in the programme 'inside' proc sgplot and the issue was solved. 

 

styleattrs datacontrastcolors=(black) datacolors = (lightgray gray); 

 

Yes, it was that simple. Thanks. Thanks to Akash once again!

 

- Dr. Abhijeet Safai

 

 

 

 

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real

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!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 11307 views
  • 7 likes
  • 5 in conversation