【问题标题】:SAS proc gplot: Regression line not ligning up with points after adjusting axis rangeSAS proc sgplot:调整轴范围后回归线未与点对齐
【发布时间】:2017-07-19 18:33:16
【问题描述】:

我正在尝试使用 proc glpot 创建一个绘图。我必须调整 y 轴(axis2)的范围以适应我感兴趣的值的范围(使用 order 选项来实现这一点)。问题是,如果我为 plot2 指定 noaxis 选项,那么回归线不再适合我的观点。如果我使用相同的水平轴和垂直轴(分别是轴 1 和轴 2)作为 plot2 的选项,那么我最终会在绘图的右侧得到另一个轴,如下图所示。

如何修复它,以便在不添加另一个轴的情况下将回归线与绘图正确匹配?

/* Set the graphics environment */                                                                                                      
    goptions reset=all cback=white border htitle=12pt htext=10pt;   

/* Define the title */                                                                                                                  
title1  "001";                                                                       

/* Define the axis characteristics */                                                                                                   
axis1 label=("Age");                                                                                                              
axis2 label=(angle=90 "Value") minor=(n=4) order= 0 to 1 by .1;                                                                                         

/* Define the symbol characteristics for the scatter plot groups */                                                                             
symbol1 interpol=none value=dot color=R;                                                                                          
symbol2 interpol=none value=dot color=O;
symbol3 interpol=none value=dot color=Y; 
symbol4 interpol=none value=dot color=G; 
symbol5 interpol=none value=dot color=B; 
symbol6 interpol=none value=dot color=P; 
symbol7 interpol=none value=dot color=BL; 

/* Define the symbol characteristics for the regression line */                                                                                 
symbol8 interpol=rlclm90 value=none color=BL W=1;


/* Define the legend options */                                                                                                         
legend1 frame label=none repeat=1                                                                                                    
        value=("1" "2" "3" "4" "5" "6" "7");                                                                                                     

proc gplot data=test;                                                                                                          
   plot value*age=missile / haxis=axis1 
                            vaxis=axis2 
                            legend=legend1
                            vref=.1 
                            vref=.7 
                            lvref=3 
                            cvref=R;                                                                     
    plot2 value*age / haxis=axis1 vaxis=axis2;
    run;                                                                                                                                    
    quit; 

【问题讨论】:

    标签: plot sas regression axis proc


    【解决方案1】:

    我意识到,如果同时使用 vaxis 和 noaxis 这两个选项,它仍然会应用轴范围,但会从图的右侧删除轴标签和刻度线。因此,我为获得所需结果而更改的代码如下所示:

    plot2 value*age / vaxis=axis2 noaxis;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多