Hi All,
I am trying to generate a figure plot using the below code. I am getting the output as in the attached screen shot.
proc sgpanel data=have ;
panelby SUBJID / layout=PANEL novarname columns=4 rows=2;
series x=x_axis_var y=aval /group=trt01p_ lineattrs=(pattern=mediumdash thickness=2);
scatter x=x_axis_var y=aval /group=trt01p_ markerattrs = (symbol=circlefilled size=8);
rowaxis integer grid values=(0,50,75,100) label="test";
colaxis integer grid values=(1 to 10 by 1) discreteorder=data label="Day";
run;
quit;
My query is how can we change the Blue color plots 'Green', Red color plots to 'Blue' and the bottom Legend with Green and Blue colors?
The colors and order by default come from the current style you have.
You can override the order and colors with a STYLEATTRS statement.
Since you are using lines and markers the specific element you want to override is the DATACONTRASTCOLORS.
Try adding:
styleattrs datacontrastcolors=(green blue);
The first group value encountered should get green lines and markers and the second would be blue. If the order isn't as desired then switch them in the statement. Note that the third or other group values will still have the default colors.
If you want to modify the colors slightly you can use words like bright, dark, light (and a few more) such as darkgreen brightblue.
Or investigate all of the color naming schemes SAS uses.
The colors and order by default come from the current style you have.
You can override the order and colors with a STYLEATTRS statement.
Since you are using lines and markers the specific element you want to override is the DATACONTRASTCOLORS.
Try adding:
styleattrs datacontrastcolors=(green blue);
The first group value encountered should get green lines and markers and the second would be blue. If the order isn't as desired then switch them in the statement. Note that the third or other group values will still have the default colors.
If you want to modify the colors slightly you can use words like bright, dark, light (and a few more) such as darkgreen brightblue.
Or investigate all of the color naming schemes SAS uses.
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 16. 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.