Heatmap SAS某些标签为粗体

时间:2018-10-18 14:05:25

标签: sas label heatmap

我正在尝试在y轴上带有一些粗体标签的SAS上执行热图。我没有在sgplot热图中找到执行此操作的选项。我尝试使用dattrmap选项并创建子组,但是我做的所有测试都不起作用。

我的代码如下:

PROC SGPLOT DATA=mydata NOBORDER NOAUTOLEGEND dattrmap=attrheatmap;
HEATMAP X=response Y=item /colorresponse=percent discretex discretey colormodel=(white blue);
text X=response Y=item text=percent/TEXTATTRS=(color=black family="Arial") ;
YAXIS DISPLAY=(nolabel) VALUEATTRS=(Family=Arial) REVERSE;
XAXIS DISPLAY=(nolabel) VALUEATTRS=(Family=Arial);
gradlegend;RUN;

我添加了dattrmap选项,并使用以下数据指定了我的表:

id   textcolor textweight value
text   Black       bold       1
text   Black      normal      2

然后,在Mydata数据集中,我根据需要用粗体显示的标签在“子组”列中指定了1或2。我已经尝试了以下测试:

text X=response Y=item text=percent/TEXTATTRS=(color=black family="Arial") textgroup=subgroup textgroupid=text;

HEATMAP X=response Y=item /colorresponse=percent discretex discretey colormodel=(white blue) textgroup=subgroup;

有人有主意吗?

1 个答案:

答案 0 :(得分:1)

您不能直接在轴上使用属性映射。

您最好的选择是使用注解,或者制作一个轴 table 来支持此功能。

有关该主题,请参见Sanjay's blog post或下面的示例:

data mydata;
 set sashelp.class;
 response=weight;
 item=age;
 percent = weight;
 groupid = ifn(age>13,1,2);
run;
data attrheatmap;

  input id $ textcolor $ textweight $ value;
  datalines;
 text red bold 1
 text Black normal 2
 ;;;;
 run;

PROC SGPLOT DATA=mydata NOBORDER NOAUTOLEGEND dattrmap=attrheatmap;
HEATMAP X=response Y=item /colorresponse=percent discretex discretey colormodel=(white blue);
text X=response Y=item text=percent/TEXTATTRS=(color=black family="Arial") ;
YAXIS DISPLAY=(novalues nolabel) VALUEATTRS=(Family=Arial) REVERSE;
YAXISTABLE item/position=left location=outside textgroup=groupid textgroupid=text stat=mean;
XAXIS DISPLAY=(nolabel) VALUEATTRS=(Family=Arial);
gradlegend;RUN;
相关问题