sgpanel vbar在相同颜色的组内区分填充图案

时间:2018-03-27 16:27:10

标签: sas

我正在使用SAS 9.4,并创建了一个带有sgpanel的漂亮条形图 enter image description here

代码如下:

proc sgpanel data=transp_5;
panelby position / layout=columnlattice onepanel
                   colheaderpos=bottom rows=2 novarname noborder;
styleattrs datacolours=(CXbe0a6e CXbe0a6e 
                        CXe17d00 CXe17d00 
                        CXbcc121 CXbcc121 
                        CX3caf7f CX3caf7f 
                        CX0077ad CX0077ad) 
            DATACONTRASTCOLORS=(nocolour);
                        format position order.;
                        format crop_type concatf.; 
vbar crop_type /  group=crop_type response=col1 stat=sum  nostatlabel     
                  barwidth=1 groupdisplay=cluster CLUSTERWIDTH= 1;
colaxis display=none;
rowaxis grid labelattrs =(size=12)  valueattrs=(size=12)   
             label="probability" ;
keylegend  / valueattrs=(size=10) titleattrs=(size=10) AUTOITEMSIZE 
             title="crop group" down=2; 
where time in ("Feb01", "Jul02", "Aug01", "Sep01" ," Okt02" , 
                "Nov01");
run;
我现在想要的是,要区分属性" Ps"和" Pfw"对于作物(例如具有相同颜色的玉米玉米),使用填充图案,如虚线或其他东西。 我发现FILLPATTERNATTRS =选项应该与sgpanelm一起使用,但它到目前为止还没有工作。 如何在SAS 9.4中将填充颜色和填充图案与sgpanel结合起来? 谢谢, 桑德拉

1 个答案:

答案 0 :(得分:0)

我使用SAS 9.4并更新到M5以使用fillpatterms,但它没有用。但是:我解决了,是的!在此处查看结果:enter image description here 我使用了一个样式模板并对其进行了如下修改

proc template;                                                                
 define style Styles.meins;                                              
 parent = styles.Journal3; 
  style GraphData1 from GraphData1 /                                      
    fillpattern = "solid";
  style GraphData2 from GraphData2 /                                      
    fillpattern = "L1";                                                  
  style GraphData3 from GraphData3 /                                      
    fillpattern = "solid";                                                 
  style GraphData4 from GraphData4 /                                      
    fillpattern = "L1";                                                  
  style GraphData5 from GraphData5 /                                      
    fillpattern = "solid";                                                  
  style GraphData6 from GraphData6 /                                      
    fillpattern = "L1";                                                  
  style GraphData7 from GraphData7 /                                      
    fillpattern = "solid";                                                  
  style GraphData8 from GraphData8 /                                      
    fillpattern = "L1";                                                  
  style GraphData9 from GraphData9 /                                      
    fillpattern = "solid";                                                  
  style GraphData10 from GraphData10 /                                      
    fillpattern = "L1";                                                  
  style GraphData11 from GraphData11 /                                    
    fillpattern = "solid" ;                                                  
  style GraphData12 from GraphData12 /                                    
    fillpattern = "L1" ;                                                  
  style GraphData13 from GraphData13 /                                    
    fillpattern = "solid";  
  end;
run; 

ods graphics on;
 ods html path ='datasave_path'
 image_dpi=500
 style=meins; quit;
proc sgpanel data=zusammen;
 panelby position/ layout=columnlattice onepanel
                   colheaderpos=top novarname noborder spacing=1;
styleattrs datacolors=(CXbe0a6e CXbe0a6e
                       CXe13f0d CXe13f0d
                       CXe17d00 CXe17d00
                       CXbcc121 CXbcc121
                       CX3caf7f CX3caf7f
                       CX0077ad CX0077ad
                       CXB2B2B2)
DATACONTRASTCOLORS=(black); 
           format position order.;
           format crop_type concatf_a.; 
vbar crop_type /  group=crop_type response=col1 stat=sum  nostatlabel 
                  barwidth=1 groupdisplay=cluster
                  CLUSTERWIDTH=1;
colaxis display=none;
rowaxis grid labelattrs =(size=12)  valueattrs=(size=12)   
             label="probability" GRID VALUES = (0 TO 1 BY 0.1);
keylegend  / valueattrs=(size=10) titleattrs=(size=0) AUTOITEMSIZE 
             title="" down=4 noborder;
 where time in ("Feb01", "Feb02" , "Mar01" , "Mar02" , "Apr01" ); 
run;

我没有使用属性贴图,但如果样式模板不能正常工作,这将是下一步。 谢谢, 桑德拉