SAS中文论坛

标题: Is it possible to color individual boxplots differently? [打印本页]

作者: shiyiming    时间: 2011-5-12 09:38
标题: Is it possible to color individual boxplots differently?
如果在一个graph中 有3个boxplots,有没有可能给每个boxplots上不同的颜色呢?
作者: shiyiming    时间: 2011-5-12 13:42
标题: Re: Is it possible to color individual boxplots differently?
use symbol?
作者: shiyiming    时间: 2011-5-12 21:52
标题: Re: Is it possible to color individual boxplots differently?
An example. Jingju

[code:bbeecg8z]proc summary data =sashelp.class noprint;
        class sex;        var Height;
        output out =out MIN =MIN MAX =MAX MEAN =MEAN MEDIAN =MEDIAN Q1 = Q1 Q3=Q3;
run;
data out1;
        length sex $3.; set out; drop _type_ _freq_;
        if missing(sex) then sex ='ALL';
run;
proc transpose out =out3(rename =(_name_ =stat)); id sex;
run;
proc template;                                                               
   define statgraph _3boxplot_;                        
      begingraph;                                            
                        entrytitle "Make a 3-color boxplots";
               layout overlay /xaxisopts=(display=none offsetmin=0 offsetmax=0) yaxisopts=(label="Group Height") ;
                              boxplotparm x=eval(not missing(stat)) y=F stat=stat / name="Female"
                      fillattrs=(color =grey transparency=0.65) discreteoffset=-0.33 boxwidth=.2;  
                  boxplotparm x=eval(not missing(stat)) y=M stat=stat / name="Male"
                      fillattrs=(color =blue transparency=0.65) discreteoffset=0.00 boxwidth=.2;  
                                                boxplotparm x=eval(not missing(stat)) y=all stat=stat / name="ALL"
                      fillattrs=(color =red   transparency=0.65) discreteoffset=0.33 boxwidth=.2;
                  discretelegend "Female" "Male" "ALL";
               endlayout;                                                     
      endgraph;                                                               
   end;                                                                       
run;
ods pdf;
        proc sgrender template="_3boxplot_"; run;
ods _all_ close; ods listing;[/code:bbeecg8z]
作者: shiyiming    时间: 2011-5-13 00:01
标题: Re: Is it possible to color individual boxplots differently?
good job  <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2