0

我正在使用 proc 模板来创建泳道图。我正在使用布局点阵创建 3 列,前 2 列是行标识符,第三列是条形图。但是,前 2 列与条形图上的排序顺序不匹配。下面是代码。

PROC TEMPLATE;
    Define statgraph swimmer2;
        Begingraph / designwidth=900px designheight=900px;
        
        layout lattice/columns=3 columngutter=2
            columnweights=(.25 .05 .65);
            
        column2headers;
            entry halign=center "Cohort"/textattrs=(size=7.5pt weight=bold);
            entry halign=center "Subject ID"/textattrs=(size=7.5pt weight=bold);
        endcolumn2headers;
        
        /*Cohort*/
        layout overlay/walldisplay=none border=false
                       yaxisopts=(display=none reverse=true type=discrete)
                       xaxisopts=(display=none offsetmin=0.5 offsetmax=1);
        scatterplot y=subjid x=col1/ markercharacter=col1 markerattrs=(size=0) ;
        endlayout;
        
        /*Subject*/
        layout overlay/walldisplay=none border=false
                       yaxisopts=(display=none reverse=true type=discrete)
                       xaxisopts=(display=none offsetmin=0.19 offsetmax=.85);
            scatterplot y=subjid x=subjid/markercharacter=subjid markerattrs=(size=0) ;
        endlayout;
        
        Layout Overlay/
        xaxisopts=(label="Weeks" labelattrs=(weight=bold size=10pt)
            linearopts=(viewmin=0 viewmax=40
            TICKVALUESEQUENCE=(start=0 end=72 increment=5))
            griddisplay=on
            offsetmin=0 offsetmax=0
            tickvalueattrs=(weight=bold size=8pt)) 
        yaxisopts=(label="Subjects" labelattrs=(weight=bold
            size=10pt)
            tickvalueattrs=(weight=bold size=6pt)
            type=discrete
            offsetmin=0.03 offsetmax=0.03
            display=all);

        HIGHLOWPLOT y=subjid low=low high=week/
            group=TRT01A index=trt01an
            TYPE=LINE LINEATTRS=(THICKNESS=8PT)
            HIGHCAP=CAP
            HIGHLABEL=week LABELATTRS=(COLOR=CX000000)
            name="trt01a" grouporder=descending ;
    
        SCATTERPLOT x=pd_ady y=subjid/MARKERATTRS=(SIZE=5pt color=cx2a8307
        SYMBOL=trianglefilled) name="PD" LEGENDLABEL="PD";

        SCATTERPLOT x=ne_ady y=subjid/MARKERATTRS=(SIZE=5pt color=cxff9900 
        SYMBOL=circlefilled) name="NE" LEGENDLABEL="NE";
        
        SCATTERPLOT x=sd_ady y=subjid/MARKERATTRS=(SIZE=5pt color=cxff0000 
        SYMBOL=squarefilled) name="SD" LEGENDLABEL="SD";
        
        SCATTERPLOT x=tf_ady y=subjid/MARKERATTRS=(SIZE=5pt color=cx13478c 
        SYMBOL=diamondfilled) name="TF" LEGENDLABEL="TF";       

        DISCRETELEGEND "PD" "NE" "TF" "SD"/ location=outside valign=center
        halign=right titleattrs=(weight=bold size=8pt) 
        valueattrs=(weight=bold size=8pt) across=1 ;
    endlayout;
    endlayout;
    endgraph;
    end;
run;

附件是输出。

先感谢您。 在此处输入图像描述

4

1 回答 1

1

你的前两个情节陈述中有这个:

yaxisopts=(... reverse=true)

但是你的第三个没有它!将其添加到第三个,或从前两个中删除,它们的轴将匹配。

于 2021-08-12T20:30:36.763 回答