热图 SAS 一些标签加粗

Heatmap SAS some labels bold

我正在尝试在 SAS 上执行热图,在 y 轴上使用一些粗体标签。我没有在 sgplot 热图中找到执行此操作的选项。我已经尝试使用 dattrmap 选项并创建子组,但是 none 我的女佣工作的测试。

我的代码如下:

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 选项并使用以下数据指定了我的 table:

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

然后,在 Mydata 数据集中,我根据需要在名为 "subgroup" 的列中以粗体显示的标签指定了 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;

有人有想法吗?

不能直接在轴上使用属性贴图。

你最好的选择是使用注释,或者制作一个轴 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;