BookmarkSubscribeRSS Feed
Dave25
Quartz | Level 8

 I'm trying to apply different colors to the text of individual tick mark values.  Below is an example of code I tried; also tried

valueattrs = (color = red color= green color = blue);

which didn't work either.

 

Any suggestions?

 


data a;
District = 'D1'; score = 6; output;
District = 'D2'; score = 6; output;
District = 'D3'; score = 6; output;
run;

proc sgplot data=a;
 hbar District/response=score;
yAXIS 
values=('D1' 'D2' 'D3') 
valueattrs = (color = red green blue);
run;
2 REPLIES 2
himself
Pyrite | Level 9

Hi did  you wanted to achieve something like this 

 

proc template;
  define statgraph MyGraphTemplate;
    begingraph;
      layout overlay / 
           xaxisopts=(label="X Axis Label" labelattrs=(color=blue size=12pt))
           yaxisopts=(label="Y Axis Label" labelattrs=(color=red size=12pt));
        scatterplot x=weight y=height;
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.class template=MyGraphTemplate;
run;

image.png 

 

For more on this please see the below link 

Creating and Customizing Graphics using Graph Template Language 

Dave25
Quartz | Level 8

 

Not the LABEL, but thank you for the suggestion.  I'm trying to apply different colors to the axis tick mark values - in the example, the text D1, D2, and D3

 

SGPlot412.png

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 73 views
  • 0 likes
  • 2 in conversation