BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
desireatem
Pyrite | Level 9

I have the SGplot below. But the axis has some issues.

1)   X and Y axes are too light in shading & the numbers for calculated concentration and hours need to be black & bold. Can anyone help?

2)The color of the plot is blue, how do I change it to red?

3) Once the figures are color-coded, can they be saved as a picture to conserve space

 

 

 

 

 

PROC SGPLOT DATA=Uplex1;

where Biomarker in ('IL-6');
VLINE Time /RESPONSE=data2 STAT=Mean group=Biomarker

MARKERS LINEATTRS = (THICKNESS = 3);
yaxis label=' Log Concentration';
xaxis label='Time in Hours' values=(0 to 72 by 12);
RUN;

 

desireatem_0-1675090080703.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
%sganno
data sganno;
%SGLINE(X1=0, Y1=0, X2=0,Y2=100, DRAWSPACE="WALLPERCENT" ,LINECOLOR="black", LINEPATTERN="SOLID", LINETHICKNESS=4)
%SGLINE(X1=0, Y1=0, X2=100,Y2=0, DRAWSPACE="WALLPERCENT" ,LINECOLOR="black", LINEPATTERN="SOLID", LINETHICKNESS=4)
run;
proc sgplot data=sashelp.class sganno=sganno;
scatter x=weight y=height;
run;

Ksharp_0-1675251651290.png

 

View solution in original post

11 REPLIES 11
PaigeMiller
Diamond | Level 26

@desireatem wrote:

 

1)   X and Y axes are too light in shading & the numbers for calculated concentration and hours need to be black & bold. Can anyone help?

 


They look black to me, not sure what "too light in shading means" but try this:

 

xaxis valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold);

 

and similarly in the yaxis statement

 

2)The color of the plot is blue, how do I change it to red?

 

You already use the LINEATTRS= option. All of this is addressed in the PROC SGPLOT documentation under the LINEATTRS= option.

 

 

3) Once the figures are color-coded, can they be saved as a picture to conserve space

 

All PROC SGPLOT output can be saved, in many different ways, including copy/paste, or via ODS. There are many ODS destinations that will store your graphics in files with names that you specify, in folders that you specify, such as ODS HTML, ODS EXCEL, ODS PRINTER and probably 14 other destinations. Do you have a specific output requirement, such as a PNG file, or an Excel file? PS: I'm not sure that this saves any space.

--
Paige Miller
desireatem
Pyrite | Level 9

Thank you!  I am close. Is there a way to make the axis denser, this is the lines, they are thin?  The X and Y axes are too thin, can I make them denser?

 

TITLE " Biomarker concerntration within 72 hours";

PROC SGPLOT DATA=Uplex1;

where Biomarker in ('IL-6');
VLINE Time /RESPONSE=data2 STAT=Mean group=Biomarker
MARKERS LINEATTRS = (THICKNESS = 2 color=red);
YAXIS label=' Log Concentration' valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold );
*xaxis valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold );
xaxis label='Time in Hours' values=(0 to 72 by 12) valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold );
RUN;

 

desireatem_0-1675092065648.png

 

desireatem
Pyrite | Level 9

This shows me how to color the axes but not to make them denser. I try the code on the link without sucess

PaigeMiller
Diamond | Level 26

I disagree, there is specific code to make the line thickness 8px

--
Paige Miller
Reeza
Super User
proc template;
define style styles.axis;
parent=styles.htmlblue;
class GraphAxisLines /
contrastcolor=red
linethickness=4;
end;
run;

ods html5 file = '/home/fkhurshed/Demo1/demo.html' style=axis;

proc sgplot data=sashelp.class;
scatter x=weight y=height;
run;

ods html5 close;

Reeza_0-1675188977250.png

 

desireatem
Pyrite | Level 9

It didn't work:

 

proc template;
define style styles.axis;
parent=styles.htmlblue;
class GraphAxisLines /
contrastcolor=red
linethickness=4;
end;
run;

PROC SGPLOT DATA=data31;

VLINE Time /RESPONSE=data1 STAT=Mean group=Biomarker

MARKERS LINEATTRS = (THICKNESS = 3 color=green) ;
YAXIS label=' Calculated Concentration (pg/mL)' valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold );
*xaxis valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold );
xaxis label='Time in Hours' values=(0 to 72 by 12) valuesattrs=(Color=black Family=Arial Size=12 Style=Italic Weight=Bold );
RUN;

Reeza
Super User
You missed a line of code from the example.
desireatem
Pyrite | Level 9

I  do not understand !

Reeza
Super User
There's a line of code in the example that isn't in your code as posted. Actually two. It won't work without that.
Ksharp
Super User
%sganno
data sganno;
%SGLINE(X1=0, Y1=0, X2=0,Y2=100, DRAWSPACE="WALLPERCENT" ,LINECOLOR="black", LINEPATTERN="SOLID", LINETHICKNESS=4)
%SGLINE(X1=0, Y1=0, X2=100,Y2=0, DRAWSPACE="WALLPERCENT" ,LINECOLOR="black", LINEPATTERN="SOLID", LINETHICKNESS=4)
run;
proc sgplot data=sashelp.class sganno=sganno;
scatter x=weight y=height;
run;

Ksharp_0-1675251651290.png

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 11 replies
  • 2321 views
  • 2 likes
  • 4 in conversation