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

Hi, All:

 

 

I am trying to generate graph that includes Broken Y axis.

For expressing broken axis, I used SGANNO= function, and I noticed this axis-broken marks (and reference line) are slightly thicker than X & Y axes.

I would like to change these line widths and make them all look like same, but I have no ideas.

I want them to have 0.5 pt widths. Please help me.

 

 

Sample code & output example are below.

Thank you in advance.

data test;
    length subjid $200.;
    subjid="001"; time=0; aval=40; output;
    subjid="001"; time=1; aval=80; output;
    subjid="001"; time=2; aval=70; output;
    subjid="002"; time=0; aval=85; output;
    subjid="002"; time=1; aval=90; output;
    subjid="002"; time=2; aval=50; output;
run;
proc format;
    value fval
          20="0" 40="40" 60="60" 80="80" 100="100";
run;
data breakline;
    function="line"; x1=-0.02; y1=31.0; x2=0.02; y2=31.0; drawspace="datavalue"; linecolor="black"; output;
    function="line"; x1=-0.02; y1=30.0; x2=0.02; y2=30.0; drawspace="datavalue"; linecolor="black"; output;
    keep drawspace function linecolor x1 y1 x2 y2;
run;
proc template;
    define style style2.mystyle;
    parent=styles.listing;
    class graphwalls / frameborder=off;
    end;
run;
ods graphics on / reset
                  imagename="test" imagefmt=emf border=off
                  width=6in height=5in
                  ;
ods rtf file="PleaseSpecifyYourOwnFolder\test.rtf";
proc sgplot data=test noautolegend sganno=breakline;
    series x=time y=aval / group=subjid lineattrs=(pattern=1 color=black thickness=0.5pt);
    xaxis labelattrs=(color=black family="Times New Roman" size=9pt) label="Time Point" 
          values=(0 to 2 by 1) valueattrs=(color=black family="Times New Roman" size=9pt) offsetmin=0 offsetmax=0.05;
    yaxis labelattrs=(color=black family="Times New Roman" size=9pt) label="Test Value" 
          values=(20 to 100 by 20) valueattrs=(color=black family="Times New Roman" size=9pt) offsetmin=0 offsetmax=0.02;
    refline 40 90 / lineattrs=(color=black pattern=shortdash thickness=0.5pt);
    format aval fval.;
run;
ods rtf close;

ex.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

In the annotation data set, you can set LINETHICKNESS=1 to make it match the axis line.

 

Hope this helps!

Dan

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

In the annotation data set, you can set LINETHICKNESS=1 to make it match the axis line.

 

Hope this helps!

Dan

KentaMURANAKA
Pyrite | Level 9

Hi, DanH-san:

 

 

Thank you for your quick reply. Your code worked for me.

I read SAS Manual and I think LINETHICKNESS= option can have values, 1, 2, or 3.

 

Thanks to your explanation, I understand "1" means same as the axis line width.

Really thanks!!

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
  • 6851 views
  • 1 like
  • 2 in conversation