SAS:在proc gplot中更改参考标签的颜色和厚度

时间:2019-03-19 18:58:06

标签: sas format ods sas-studio sgplot

我正在尝试在针线图中绘制不同的薪水水平,我想要一个参考线。以下代码提供了该参考线,但该线与针的颜色相同,并且太细。有办法改变吗?

SYMBOL1
    INTERPOL=NEEDLE
    HEIGHT=10pt
    VALUE=NONE
    LINE=1
    WIDTH=2
    CV = _STYLE_
;
Axis1
    STYLE=1
    WIDTH=1
    MINOR=NONE
    REFLABEL=(j=c color = red width = 5 '');
;
Axis2
    STYLE=1
    WIDTH=1
    MINOR=NONE
;
TITLE;
TITLE1 "Bootstrap: Needle Plot of log salary";
PROC GPLOT 
    DATA = sashelp.baseball
    ;
    PLOT logsalary * name /
        VAXIS = AXIS1
        HAXIS = AXIS2
        VREF  = 4
    ;
RUN; QUIT;

1 个答案:

答案 0 :(得分:1)

参考线的颜色和宽度由VREF语句的CVREFWVREFPLOT选项上的枚举列表控制。参考线的标签和颜色必须与AXIS语句中的类似枚举列表手动对齐。

可以使用注释数据集对绘图过程进行其他控制。特别是,可以指定要在过程完成绘制之后绘制注释,并且渲染结果将显示在过程输出的顶部。

示例

SYMBOL1 INTERPOL=NEEDLE HEIGHT=10pt VALUE=NONE LINE=1WIDTH=2 CV = _STYLE_ ;

Axis1 order = 0 to 10 STYLE=1 WIDTH=1 MINOR=NONE
    REFLABEL = 
      ( j=c color=RED height=4 "HELLO"     /* labels for two reference lines */
        j=l color=BLUE height=3 "EIGHT"  
      );
Axis2 STYLE=1 WIDTH=1 MINOR=NONE ;

TITLE;
TITLE1 "Bootstrap: Needle Plot of log salary";

options mprint;

DATA anno;
   %annomac;
   when = 'After';
   %system (1,2,4)
   %line (0,1, 100,1, GREEN, 0, 6)
   %label (30, 1.2, "LABEL AFTER", GREEN, 0, 0, 4, , B)
/* %LABEL (x, y, text-string, color, angle, rotate, size, style, position); */
RUN;

PROC GPLOT 
    DATA = sashelp.baseball(obs=20)
    ANNO = anno
    ;
    PLOT logsalary * name /
        VAXIS = AXIS1
        HAXIS = AXIS2

           VREF = ( 4  8 )         /* axial data value of reference lines */
          WVREF = ( 4  6 )         /* Width and colors of reference lines */
          CVREF = ( RED BLUE )
    ;
run;quit;